我想并排添加两个textctrl。当我尝试这样做时,它给了我一个在另一个之上。我正在尝试这种方式
bs = wx.BoxSizer(wx.VERTICAL)
self.t1 = wx.TextCtrl(p,size =(120,30),style = wx.TE_MULTILINE | wx.TE_CENTER)
bs.Add(self.t1, 1, wx.EXPAND)
self.t2 = wx.TextCtrl(p,size = (120,30),style = wx.TE_MULTILINE |wx.TE_CENTER)
bs.Add(self.t2,1,wx.EXPAND)
答案 0 :(得分:1)
使用wx.HORIZONTAL
框大小调整器
import wx
class Myframe(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None)
self.panel = wx.Panel(self)
bs = wx.BoxSizer(wx.HORIZONTAL)
self.t1 = wx.TextCtrl(self.panel,size = (120,30),style = wx.TE_MULTILINE |wx.TE_CENTER)
bs.Add(self.t1, 1, wx.EXPAND)
self.t2 = wx.TextCtrl(self.panel,size = (120,30),style = wx.TE_MULTILINE |wx.TE_CENTER)
bs.Add(self.t2, 1, wx.EXPAND)
self.panel.SetSizer(bs)
if __name__ == "__main__":
App = wx.App()
Myframe().Show()
App.MainLoop()