我有一个带有三个小部件的窗口。目前,一个文本框(TextCrtl
)占据了窗口的整个左侧大小,并且在正确的大小上,还有另一个文本框,在它下面是一个按钮(我将右侧水平放置)。我的问题是,如何翻转小部件,右侧有一个长文本框,左侧有一个较小的文本框和按钮。到目前为止,这是我的代码:
import wx
class Frame(wx.Frame):
def __init__(self, *args, **kwargs):
super(Frame, self).__init__(*args, **kwargs)
self.InitUI()
def InitUI(self):
splitter1 = wx.SplitterWindow(self, -1,style=wx.SP_LIVE_UPDATE)
splitter2 = wx.SplitterWindow(splitter1, -1,style=wx.SP_LIVE_UPDATE)
self.userEnter = wx.TextCtrl(splitter2, -1)
self.cbtn = wx.Button(splitter2, label='Close')
self.results = wx.TextCtrl(splitter1, -1)
#self.graphs = wx.TextCtrl(splitter1, -1)
splitter1.SplitVertically(self.results, splitter2)
splitter2.SplitHorizontally(self.userEnter, self.cbtn)
menubar = wx.MenuBar()
fileMenu = wx.Menu()
wx.ID_EXIT = 10
quitButton = fileMenu.Append(10, 'Quit', 'Quit this program')
menubar.Append(fileMenu, '&File')
self.SetMenuBar(menubar)
self.Bind(wx.EVT_MENU, self.OnQuit, quitButton)
self.SetSize((1090,750))
self.SetTitle('Plancials Booky')
self.Centre()
self.Show(True)
def OnQuit(self, e):
self.Close()
def main():
app = wx.App()
Frame(None)
app.MainLoop()
if __name__=="__main__":
main()
感谢。
答案 0 :(得分:1)
只需更改splitter1.SplitVertically
中小部件的顺序:
splitter1.SplitVertically(splitter2, self.results)