简体   繁体   中英

Tkinter GUI set to relative does not resize with window

I'm trying to make a gui that resizes automatically to fit the window it's in, but it's not working out too well. I tried using relative code like this:

self.console.place( relx = 0, rely = 0.1, relheight = 0.85, relwidth = 1 )

but when the window is resized, it doesn't resize the elements in it. The relative stuff works fine in the initial declaration of the widgets, it just doesn't resize after that. Am I doing something wrong, or am I just missing something?

Turns out it wasn't the fault of that code, it was simply becuase the window resizing did not automatically resize my main frame. For future reference, when trying to make an auto-resizing window, try something along these lines and make sure you weren't making my mistake:

self.pack( expand = tkinter.YES, fill = tkinter.BOTH )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM