简体   繁体   中英

wxPython: How to make a TextCtrl fill a Panel

如何设置多行TextCtrl的大小以始终填充其父面板?

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM