I am trying to create a GUI as pictured below. So far, I am using 3 frames (topbar, sidebar, and body) as the basics for splitting the GUI up. In the future, I plan to have navigation buttons on the sidebar, and body to give you a better idea of what I am trying to do.
However, I am struggling to figure out how to make the actual frames fill out the whole window when it resized. While I am new to Qt designer, I am aware of the layout feature and I have attempted to utilize it. For example the blue frame with the vertical layout, but this seems to only work on other widgets and not frames. Going back to my example, if I add the vertical layout to the blue part, it will stretch the line edit to fill the entire blue region (I want the line edit to be the size it is now) but it won't cause the blue region to fill the rest of the frame.
Is there a better widget to use for separating the GUI and adding background colors other than the frame container that I am using? Most of the examples I have seen, keep the layouts very basic, and I have not seen one where someone tries to break it up like this.
My work so far
Wire frame that shows what I am trying to do
Related
As my code is quite long and with a lot of nested layouts I won't put it in here but I essentially have a QHBoxLayout which I want to have a different background colour as the others. I First thought about changing the stylesheet but I quickly learned that the layout is not affected by that as it apparently is not a visual element. Hence my Question: How do I create simple (geometric) elements? Is it even possible to just have a colored box in the background and some lables and pictures in the foreground?
I tried just using a big QTextEdit block and colouring this with the StyleSheet but this didn't get me the results I hoped for as It'd be hard to align the text the way I want it to be and add pictures.
I'm trying to make a frame in wxPython using a wx.grid as a table and with a background image behind the cells.
I already tried placing the grid in a table and lowering the frame opacity with frame.SetTransparent(), which might work, but the frame just refuses to display if I give the parent a background with StaticBitmap. I couldn't find an alternative way to use an image as a background or a way to fix that problem.
There's also the wx.grid.SetDefaultCellBackgroundColour function, but the function only accepts RGB values with no alpha. I tried messing around with internal values but no luck there either.
Bonus points if the image doesn't overlap with the headers but at this point I'll take what I can get.
I am writing a kicad plugin, and I need to create a GUI for this plugin. Because kicad uses wxpython, that is what I am using.
I have already figured out that placing my ui items using the layout sizers just isn't gonna give me the control I need to create the window I want. I know I can set the position of elements, and have been using that to create the ui I need.
The problem however, is that my window gets bigger than what would be reasonable (in some situations). Therefore I want to make it scrollable.
I have been playing around with wxformbuilder, and I found the wxScrolledWindow. That got me this far:
This is roughly what I want, except, when you want to place stuff within the scrolledWindow, you have to place one of the "sizers" in it (as far as I can tell at least), in which you place your buttons. The problem with that is, that, to my knowledge, setting the position of buttons in any of the sizers just has no effect at all.
So, my question is: how do I achieve this effect? and, is this even possible?
edit:
As an example of what I am trying to put within the scrolledwindow, this is a rough version of the ui I want to create (and want to be scrollable). (I want to eventually have, probably an icon button above each of the checkbox columns to indicate what they are for).
The final result would need to look something like this (the white squares being small images / buttons, also, in reality being not on the window bar,but in its own not scrolling section):
An example of something I wasn't able to achieve using sizers is, getting those checkboxes so close together, without making them appear off center. Different widgets seem to have different sizes, and checkboxes without border are especially small, so they end up appearing off center, example:
Also, those images above each column of checkboxes, which don't scroll, need to line up with the X coordinates of those scrolling checkboxes, which also seems very non trivial. Though also really hard to get right if I could give everything exact coords, so I might need to give up on that specific idea of making those not scrollable.
Hi !
I've been looking all over StackExchange and some other forums for an answer to my question but I couldn't find anything relevant, so here I am, posting my question.
What I'm trying to do is to draw lines that are on the same layer as other Tkinter widgets. I'm currently coding an interface where certain widgets need to visually connect to each other (NodeBox style or Quartz Composer style).
Shows the connectors (noodles) present in Quartz Composer. (I'm not necessarily looking for curved lines, straight is more than enough.)
The problem is that it is too complicated to use the canvas widget (I will be using a lot of widgets so embedding all of them into the canvas is not really an option I think). I'm looking for something similar to the separator widget but allowing for diagonal lines and defined by coordinates. I'm thinking of creating a custom widget that does this but I'm not sure where to start. An other solution may be to have a transparent canvas right over the non-canvas widgets but that would complicate the mouse click events a lot. I don't know what option would be the best.
Any thoughts on how I could accomplish drawing lines out of canvas widget? (Or on how I can create a custom widget that does this?)
Your only reasonable choice for drawing lines is the canvas. Without the canvas you can simulate horizontal or vertical lines using a separator and place, but you can't do diagonal lines.
I have been making a small program with the Tkinter module in python, and I was wondering whether it was possible or not to resize a frame in my program with the mouse. As in, the user can drag the frame border and it will resize itself.
Your use of terminology makes the question unclear. Windows which may be resized by the user are called Toplevel windows. These are what appear as rectangular windows on the display, with a frame around them, typically a title bar, and edges or corners that can be grabbed and resized.
The term Frame refers to a container widget that must be inside a Toplevel or one of its descendents. A Frame has the ability to be resized but you have to write the code to let you interactively resize them. For example, you could place a little grip widget in one or more corners, and writing bindings to the press, motion and release of a mouse button.
Depending on the effect you are looking for, you might want a PanedWindow which is a container that includes a sash that lets you adjust the proportion of space between two other widgets.