E
E
EgorSvinarev2021-07-21 11:20:39
Python
EgorSvinarev, 2021-07-21 11:20:39

How to set up frame extension?

Hello. I want to adjust frame scalability when tkinter window is resized.
There are two frames that should expand evenly in length as the width of the main window changes.
60f7d85c0e197500441099.png
60f7d861ca6fd540964138.png
As you can see, the frames do not change their size.
I also attach the code that configures them:

left_frame = Frame(self.surf)
    right_frame = Frame(self.surf)

    input_form = HeaderInputForm(left_frame, self.data)
    info_panel = HeaderInfoPanel(right_frame, self.data)

    left_frame.grid(row = 0, column = 0, sticky = "W")
    right_frame.grid(row = 0, column = 1, sticky = "E")

How do I change the grid manager options so that the frames are scalable?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-07-21
@EgorSvinarev

self.surf.grid_columnconfigure(0, weight=1)
self.surf.grid_columnconfigure(1, weight= 1) Indicates
that both columns should expand equally when expanding and shrinking.
If the weights are made, say, 3 and 1, then a column with a weight of three will "eat off" 75% of the additional space, and with a weight of 1 - 25%. If the column weight is 0, it does not resize.
Similarly, there is a .grid_rowconfigure() method.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question