I've been experimenting with Frames placed in the root window. As far as I can see, the stacking order is determined when the frames are created, the ones created first being below the ones created later. The order of .place does not seem to have any effect.
Is there some way of changing the stacking order?
Typically, a Tkinter application consists of multiple frames. And you often need to switch between frames to display the one that is relevant to the user’s choice. Tkinter allows you to stack frames on top of each other. To show a particular frame, you can simply raise one above the other in the stacking order. The top frame will be visible.
Typically, a Tkinter application consists of multiple frames. And you often need to switch between frames to display the one that is relevant to the user’s choice. Tkinter allows you to stack frames on top of each other.
Tkinter allows you to stack frames on top of each other. To show a particular frame, you can simply raise one above the other in the stacking order. The top frame will be visible.
We need to move to a different section of the Tkinter GUI by clicking a Tkinter button and then could return to the main section after clicking the button in this new section. switch_frame (self, frame_class) method destroys the old frame and then replaces with the new frame frame_class.
You are probably looking for:
widget.lift() # move to the top of the stack
widget.lift(another) # move to just above another widget
widget.lower() # move to the bottom of the stack
widget.lower(another) # move to just below another widget
Explained here. (This is the best documentation I can find. If you read effbot, it reads like lift
and lower
only apply to windows, but in fact they also work with other widgets.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With