Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TKinter: how to change Frame width dynamically

Tags:

python

tkinter

how can I set width to a tk.Frame (post-initialization ?)

In other words, is there a member function to do it ? Sometheing like frame.setWidth()

thanks

like image 376
aneuryzm Avatar asked Oct 16 '25 01:10

aneuryzm


1 Answers

frame.config(width=100)

Be aware that if there are children in the frame that are managed by grid or pack, your changes may have no effect. There are solutions to this, but it is rarely needed. Generally speaking you should let widgets be their natural size. If you do need to resize a frame that is a container of other widgets you need to turn "geometry propagation" off.

like image 140
Bryan Oakley Avatar answered Oct 18 '25 18:10

Bryan Oakley