Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wxPython: Making something expand

How do I make any wxPython widget (like wx.Panel or wx.Button) automatically expand to fill its parent window?

like image 513
Ram Rachum Avatar asked Feb 28 '23 14:02

Ram Rachum


1 Answers

The short answer: use a sizer with a proportion of 1 and the wx.Expand tag.

So here I am in the init of a panel

sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.canvas, 1, wx.EXPAND)
self.SetSizer(sizer)
like image 59
Jim Carroll Avatar answered Mar 07 '23 05:03

Jim Carroll