我在水平TextCtrl
中有一个BoxSizer
。它的重量为1(重量为0的按钮旁边)。当我运行程序时,TextCtrl
将保持固定宽度,旁边有空格,无论窗口大小如何。为什么呢?
以下是代码:
wxapp = wx.App()
wxFrame = wx.Frame(None, -1 , 'Switch Time Zones', (0,0),(340,64))
wxFrame.Centre()
mainBox = wx.BoxSizer(wx.VERTICAL)
wxFrame.SetSizer(mainBox)
...#A few things are added to mainBox
outputBox = wx.BoxSizer(wx.HORIZONTAL)
mainBox.Add(outputBox, 1, wx.ALIGN_BOTTOM)
...#A few things are added to other boxes
submitButton = wx.Button(wxFrame,label='solve:')
outputBox.Add(submitButton,0)
outputText = wx.TextCtrl(wxFrame)
outputText.SetEditable(False)
outputBox.Add(outputText,1)
wxFrame.Show()
wxapp.MainLoop()
答案 0 :(得分:0)
mainBox.Add(outputBox, 1, wx.ALIGN_BOTTOM|wx.EXPAND)