Tkinter button with both left and right aligned text - python

I would like to create a button where the title is left aligned and then a value with units that is right aligned.
I need to be able to press it in ordre to open a new frame for changing the value.
I haven't been able to find a solution..
I have also tried to create two labels and then placing them inside the button but with no luck.
Any good solution is more than welcome.
Picture

Related

How to move canvas drawn shapes to have a fixed position on screen?

I have a GUI that I've made in tkinter using a canvas that has a bar along the left side and a bar along the top containing information. In the remaining area various rectangles are drawn corresponding to the information in those bars I described. The issue is, when you scroll away on the canvas, those events will leave as well.
Basically, I want to create a visual effect like position: fixed is in CSS where these bars on the side and the top stay in place relative to the rest of the canvas so that they don't move from their relative position while scrolling.
I tried making use of the scrollbar commands, but have had trouble making my own function there. I also tried to see if there was an event I could bind to the canvas to track the movement so that I could move the bars myself but I could not find anything.
There is no way to do this directly in the canvas unless you write the code to move the items in the top and left whenever the user scrolls. It would probably require a fair amount of work.
However, it's trivial to have separate canvases for the side and top that do not scroll, and a third canvas that has all of the scrolled data.
I was able to end up solving my own issue by adapting the solution from: How can I add Unscrollable Image to a frame/Canvas?
Simply put, I made my own yview and xview functions that would scroll my desired "bars" with the window by moving the objects.
Special thanks to #jasonharper for his help.

How to Reorder Elements Vertically Glade + Gtk?

I'm using Glade to design a UI, and I'm struggling to figure out how to reorder elements such that one element is on top of the other vertically. As an example, I added a draw element after a slider, picture, but I want to still be able to touch the slider through the draw element. Beyond reordering things manually in the XML/.glade file, how would I move things around such that the draw element gets "drawn" first with the slider on top of it?
Die clarification. So far i See from the picture (I dont understand the Text), you create radio buttons and in one type of it, you want to dynamically letting a new window area appearing with a slider in it when clicking?

Is there any command to make my tkinter labels splitted but still one label?

Im talking about making my labels like connected buttons at the same width as normal one.
Second one I need to make is longer like two normal labels.
Here's an image how it has to look like. How can I make left upper corner labels and right lower corner label?
Do you have any idea? Any command? Searching in the website is not enough :(

how to fix the position of canvas and graph in vpython?

Before I say it, Sorry for my poor English.
I'm making an orbit simulation with vpython, because the earth science teacher asked me to.
The link below is the result of my work so far.
https://glowscript.org/#/user/sungho2574/folder/MyPrograms/program/2
Unfortunately, I can't watch the simulation and the graphs simultaneously, so I want to put two graphs side by side and put them right under the canvas. Also, I want to put "setting" next to the 3d canvas.
I tried various ways, but nothing worked.
And I found this vpython 6 link.
https://vpython.org/contents/new_features.html
In this link, I could find the GUI image that canvas and setting are located side by side.
But I also failed to work with it.
Can I put canvas or whatever freely in vpython 7?
Or in vpython 6?
VPython 6 ended many years ago. VPython 7 exists, but has the same syntax and capabilities as the Web VPython you are using at glowscript.org. From the documentation on canvases at
https://www.glowscript.org/docs/VPythonDocs/canvas.html
is this information on aligning canvases (and graphs):
align Set to "left" (canvas forced to left side of window), "right" (canvas forced to right side of window), or "none" (the default alignment). If you have a single canvas, setting align to "left" causes the canvas caption to be displayed to the right of the canvas. If you want to place a graph to the right of a canvas, set the canvas align attribute to the string "left" and the graph align attribute to the string "right". If the window is too narrow, the object that is on the right will be displayed below the other object. If you want to place a graph to the right of the canvas but keep the canvas caption underneath the canvas, create the graph first with align set to "right" and activate the graph by plotting something in it, then create the canvas without specifying its value of align. Another option is to specify align='left' for all canvases and graphs, in which case they will abut each other.
Here is an example (make the window wide):
https://www.glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/HardSphereGas-VPython

How do I make changes to a cell using wxPython DataViewCtrl?

I am using wxPython's DataViewCtrl to display some data. On the first column I am displaying an icon using AppendIconTextColumn. The problem is that the icon is shifted to the right and the right portion of the icon is cut off. I have tried using the flag align=ALIGN_LEFT, but that has no affect.
It seems that there should be more options for configuring a cell. Like changing the background color or aligning images.
Can someone please show me how I can move the icon in the cell?
Thank you so much.

Categories

Resources