Layout settings ignored when UI is run in Python #161
-
I have created a custom UI that uses TkScrolledFrame and TkScrolledText and when I use Pygubu Designer to open it (F5) every widget behaves as I want upon resizing the window. But when I open the UI in a Python script, the window is stagnant. When I resize, the window shows white space beyond the initial window size when I make the window larger, and the window simply cuts off anything if I make it smaller than the initial window size. I am getting a Python error: Hopefully when I resolve that error this problem will go away. Changed the UI file to a txt file for upload. For reference, here is my Python code. Saved as a txt file. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hello @2briancox thanks for trying pygubu. Lets start with this:
You have set (maybe accidentally) container = True in the frame. This is a special property used to embed an entire toplevel window inside a frame. If you set to empty or False the error will disappear.
I found some problems here. When you use grid you have to try not to leave gaps in the grid. For example here you positioned the frames in rows 5 and 6, so rows 0 to 4 are empty. This can cause problems later when configuring the elasticity of the grid. As you are using a frame as the main widget of the UI, you need to configure the stretching of the toplevel: def __init__(self, master):
....
builder.add_from_file('{}\\Resources\\GUI.ui'.format(self.fullPath))
self.mainwindow = builder.get_object('frame_1', master)
self.master.minsize(940, 0)
# Configure stretching of master.
self.master.columnconfigure(0, weight=1)
self.master.rowconfigure(0, weight=1)
#
builder.connect_callbacks(self)
This is the normal behaviour of Tk. You can avoid that setting a minimum size for the toplevel. def __init__(self, master):
....
# Configure stretching of master.
self.master.columnconfigure(0, weight=1)
self.master.rowconfigure(0, weight=1)
# Configure minimum size
self.master.geometry("1140x800")
self.master.minsize(1140, 800)
self.master.resizable(True, True)
builder.connect_callbacks(self) Hope this helps you. Let me know if you have more questions. Regards |
Beta Was this translation helpful? Give feedback.
-
I am again having intermittent issues with this pygubu.builder.widgets.tkscrolledframe. I have it inside of a frame to control its size. Now it intermittently stops scrolling. Either because of a click event within an widget in the tkscrollframe, or perhaps after the appearance or disappearance of a tooltip I made. (Small Frame). When this happens, the user can fix it by moving the mouse off of the scrollframe and then back onto it. This is frustrating users. My question is, what is the method/object-method to grab ahold of within the tkscrolledframe so I can control the yscroll? My goal is to set a global bind to the whole window so that no matter where the mouse is in the window it always controls the tkscrolledframe. I had assumed I could use tkscrolledframe.yview_scroll, but that isn't recognized. Do you have other thoughts that may help resolve this? |
Beta Was this translation helpful? Give feedback.
Hello @2briancox thanks for trying pygubu.
Lets start with this:
You have set (maybe accidentally) container = True in the frame. This is a special property used to embed an entire toplevel window inside a frame. If you set to empty or False the error will disappear.