I have a simple pygtk/glade window with a menu and a 3x3 grid. Each row of the grid consists on: two labels and a button.
When the Window is resized, the labels holds the same font size, but the buttons get resized, and they could become HUGE if the windows gets very big.
How could I manage to keep my buttons with the same size always (the "standar" size of a button, just like they are when the interface is just opened) no matter if the Window is resized?
You just have to set the fill and expand parameters of the Buttons to False (uncheck them in the Glade interface).
You would also want to put each button at the center of a 3x3 GtkTable, so it will appear centered and not aligned at the top of the cell
Related
i'm new to GUIs and qt designer, and i just can't figure out why my frames and widgets in don't resize uniformly when the window is resized
heres a gif showing what i mean. https://puu.sh/E6ljI/9038479169.gif . when the window is stretched or shrunk horizontally, the left two frames stretch before the right two. and when stretching vertically, the bottom two stretch before the top two. the expected outcome i want, is to have everything expand and shrink together, so if i expand the window horizontally, everything should expand together at the same rate. ideally, i'd like all 4 frames to be roughly the same sizes so that one frame takes up roughly a quarter of the window regardless of size of the window.
the whole window is in a grid layout, with each quadrant having its own frame (outlined) that stores its contents in a form layout. i've tried messing with changing the size policies but it doesn't have a noticeable difference on how it stretches (at least not that i can see)
if the problem isn't solveable inside qt designer or if it's easier to do in code, i'm using pyuic5 to convert the .ui file created by qt designer into a .py file for use with pyqt5.
link to the .ui file: https://drive.google.com/open?id=1XY_98QoMGMdbaXPIFsRGxUAoBrHpQg1_
I have a vbox in main window. Within the vbox is a menu and a fix. The fix is used to load image. I should change the size of main window according to the size of image. But I cannot find a way to get the size of menu bar. So the bottom part of the image cannot be displayed(I set the window unresizable).
I don't explicitly set the size of the menu. So it seems that all the functions ending with 'request' return -1.
How can I get the actual size of the menu bar? Or how can I display the image entirely?
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.
I'm using Python Tkinter and I want to place a variable number of text box widgets in a frame or canvas. The text boxes are packed vertically down the frame, so the first one is on top, the second one is found below, etc.. I can have all the button, listbox, etc widgets in a "left section" of the GUI, while a "right section" will only contain the text box widgets. I want the text box widgets to horizontally expand when the master window is maximized, but because there's a variable number of these widgets, the "right section" containing the text boxes also needs to be able to vertically scroll to view them all.
Currently, I'm using Canvas.create_window to add my variable number of text boxes to the canvas, and while I can scroll the canvas to view all the text boxes, they do not horizontally expand when I resize the window. I have an alternate GUI that uses a frame for the "right section", which allows the widgets to horizontally expand, but if too many are packed, I cannot scroll the frame to see the additional text boxes because I can't have a scroll bar tied to a frame.
Is there any way around this trade-off?
The solution is pretty simple: bind to the <Configure> event of the canvas -- this will cause your callback to be called whenever the canvas widget is resized. You then simply need to get the width of the canvas and use that to iteratively resize all the embedded windows.
I'm creating an app where I drag button widgets into a panel. I would like to have a visible grid in the panel where i drop the widgets so the widgets will be aligned to the grid.
I guess it isn't hard making a grid where the squares are 15x15 pixels using a GridBagSizer(since the widgets will span between multiple cells), but how can the number of squares be made dynamically according to the size of the panel?
Do I have to calculate how many squares i need to fill the panel on init and on each resize?
Using python and wxpython btw.
Oerjan Pettersen
Don't use a sizer at all for this. Just position the buttons yourself, with whatever co-ordinate rounding you like. (using wxWindow::SetSize()).
(The point of a sizer is that the buttons will get moved and/or resized when the window is resized. As you don't want that behaviour, then you shouldn't use a sizer.)