Python Forum
[WxPython] Dynamically Sized Widget
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[WxPython] Dynamically Sized Widget
#1
I have a wx.Dialog box. In that dialog, I have widgetA. WidgetA contains widgetB. WidgetB can change its size at runtime in response to user selections.

When widgetB gets larger, then widgetA, and the dialog box both need to adjust their layout/size to accomodate the larger widget. This page talks about doing this, and describes a few methods:

https://wiki.wxpython.org/WhenAndHowToCallLayout

The hierarchy is such that all panels and the dialog frame will need resizing, so I'm tempted to use one of the ideas from the page:

widget = self.widgetThatWasChanged
while widget.GetParent():
    widget = widget.GetParent()
    widget.Layout()
    widget.Fit()
    if widget.IsTopLevel():
        break
Is there any real downside to this since any fancy code would just be calling Layout() on all the parents anyway?
Reply


Messages In This Thread
Dynamically Sized Widget - by CanadaGuy - Nov-11-2018, 10:48 PM
RE: Dynamically Sized Widget - by Larz60+ - Nov-12-2018, 12:42 AM
RE: Dynamically Sized Widget - by CanadaGuy - Nov-12-2018, 12:47 AM
RE: Dynamically Sized Widget - by Larz60+ - Nov-12-2018, 02:55 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Dynamically Deleting Widget smabubakkar 1 3,502 Feb-15-2020, 11:11 PM
Last Post: Larz60+
  [PyQt] dynamically resize custom widget fill remaining space ironcthulhu 1 11,550 Dec-31-2019, 09:45 PM
Last Post: Denni
  [Tkinter] Text window not properly sized smabubakkar 1 1,970 Jun-16-2019, 08:55 AM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020