开发者

wxPython: How to make a TextCtrl fill a Panel

How do I set the size of a multi-line TextCtrl to always fil开发者_StackOverflow中文版l its parent panel?


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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜