-1

I'm currently working on this project and was wondering is there a way to resize all the children widgets present inside the parent widget when the user maximize the parent widget root, I know about .grid_rowconfigure()and .grid_columnconfigure(), but using these methods isn't changing the fontsize/actual size of my widgets. I would like to know if there's a way to bind the maximize button present on the top right conner of the parent widget.

Thank you.

Amaan
  • 5
  • 5
  • 1
    how did you try to do that, please provide a [mre] – Matiiss Sep 14 '21 at 21:13
  • Does this help? [Where can i find a list of all the window manager protocol atoms?](https://stackoverflow.com/questions/22595515/where-can-i-find-a-list-of-all-the-window-manager-protocol-atoms?r=SearchResults&s=1|62.9851). This should let you know whether there's a way to bind the maximize button. – Sylvester Kruin Sep 14 '21 at 21:38
  • Yes, there are ways using every one of the geometry managers. They all have options that control how the widgets are resized. Please provide a [mcve] that we can use to reproduce your problem. – Bryan Oakley Sep 14 '21 at 22:06

1 Answers1

0

This question has been answered here. The solution: First of all, we need to bind the window to the <Configure> event. The <Configure> event gets triggered whenever a window event occurs.

window.bind("<Configure>", is_maximized)

Now, when the event gets triggered, the is_maximized function will be called:

def is_maximized(event):
    if window.state() == "zoomed":
        # your code

In the function, we are checking if the window state is equal to zoomed. If so, it means that the window is maximized. Now, you can just add whatever code you need inside the if clause.

Roni
  • 597
  • 5
  • 21
  • You don't need to do any of this under normal circumstances. Widgets can easily be configure to grow or shrink with the window grows or shrinks. – Bryan Oakley Sep 14 '21 at 22:08
  • @BryanOakley, thanks for pointing it out. I am aware of that. That's just what he asked for. – Roni Sep 14 '21 at 22:09
  • Thank you mate, I figured it out. Thanks for the help, really much appreciated. – Amaan Sep 15 '21 at 00:17
  • @Amaan, if my answer helped you, I’d really appreciate it if you’d upvote or accept the answer – Roni Sep 15 '21 at 06:38
  • I would but it's says I need 15 reputation to upvote. – Amaan Sep 16 '21 at 23:04
  • @Amaan, you can accept the answer. It doesn't require a specific amount of reputation. – Roni Sep 17 '21 at 13:12