Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wxPython: How to make a TextCtrl fill a Panel

How do I set the size of a multi-line TextCtrl to always fill its parent panel?

like image 208
Johnny Avatar asked Aug 05 '10 23:08

Johnny


1 Answers

Use a boxSizer.

When you add your textCtrl to the sizer set the proportion to 1 and pass the wx.EXPAND flag, that way your textCtrl should fill the panel even when the panel is resized

bsizer = wx.BoxSizer()
bsizer.Add(yourTxtCtrl, 1, wx.EXPAND)

Put the following at the end of your panels initialization to set the layout

self.SetSizerAndFit(bsizer)
like image 195
volting Avatar answered Sep 24 '22 20:09

volting