Python 3.4 Tkinter - not able to give a size to frames in PanedWindow Python 3.4 Tkinter - not able to give a size to frames in PanedWindow tkinter tkinter

Python 3.4 Tkinter - not able to give a size to frames in PanedWindow


Indeed, you can not change the dimensions of the Frame instances directly as you tried because both frames are PaneWindow child widgets.

To resolve your problem, you need to investigate paneconfig() method like this:

_F_Cassa.paneconfig(_F_Left, width = 120, height = 400, sticky = E+W+S+N)_F_Cassa.paneconfig(_F_Right, width =  200, height = 400, sticky = E+W+S+N)

Full program:

from tkinter import *_root = Tk()_root.title("BEGUERADJ PaneWindow")_F_Cassa = PanedWindow(_root, orient = HORIZONTAL)_F_Cassa.pack(fill = BOTH, expand = True )"""Every column and row has a "weight" grid option associated with it, which tells it how much it should grow if there is extra room in the _F_Cassa to fill. By default, the weight of each column or row is 0, meaning don't expand to fill space."""_F_Cassa.grid_rowconfigure(0, weight = 1)_F_Cassa.grid_columnconfigure(0, weight = 1)# I set background colors just to highlight the results_F_Right = Frame(_F_Cassa, bg = "blue")_F_Left = Frame(_F_Cassa, bg = "yellow")    _F_Cassa.add(_F_Left)_F_Cassa.add(_F_Right)_F_Right.grid(row = 0, column = 1)_F_Left.grid(row = 0, column = 0)_L_NomeS = Button(_F_Left, text = "Sinistra")_L_NomeS.grid(row = 0, column = 0)_L_NomeD = Button(_F_Right, text = "Destra")_L_NomeD.grid(row = 0, column = 0)   # Resize frame widgets:_F_Cassa.paneconfig(_F_Left, width = 120, height = 400, sticky = E+W+S+N)_F_Cassa.paneconfig(_F_Right, width =  200, height = 400, sticky = E+W+S+N)_root.mainloop()

Demo

enter image description here