Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change window size each tab tkinter notebook

I am a new tkinter user, and I was starting to make a notebook of some math programs. I wanted to make it so that the size of the notebook window changes based on the tab. So in tab1, there are more widgets, so that when packed together they take up less space than tab2. But when I go to tab2 the window is the same size, leaving a lot of black space. How can I get rid of that?

Thank you

like image 408
zih301 Avatar asked Mar 20 '26 23:03

zih301


1 Answers

I'm not sure if the notebook widget would normally allow that, but you could try making sure that your window/frames are set to allow propagation/expansion depending on what geometry manager you are using.

see the following:

pack geometry manager

grid geometry manager

the other way of course would be to bind your own resizing methods to the tab change:

notebook.bind("<<NotebookTabChanged>>", resizingfunction)

and then you could either call the geometry function on the parent window (assuming its the direct parent) or the height and width of the parent frame

James

like image 176
James Kent Avatar answered Mar 22 '26 13:03

James Kent



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!