我想用两个笔记本创建一个窗口。左边的应该总是尽可能窄。右边的应该尽可能宽,并在调整窗口大小时展开。在Wx中可行吗?
这就是我在 wxFormBuilder 中设法完成的。当我调整窗口大小时,两个笔记本的宽度总是相同的。
我尝试改变他们每个人的 sizerItem 比例,但这显然只会改变比例。我只想让正确的扩展。更改每个笔记本的 wxEXPAND 标志只会更改垂直扩展而不是水平扩展。
感谢帮助。
生成的代码:
# -*- coding: utf-8 -*-
###########################################################################
## Python code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
## http://www.wxformbuilder.org/
##
## PLEASE DO *NOT* EDIT THIS FILE!
###########################################################################
import wx
import wx.xrc
###########################################################################
## Class MyFrame1
###########################################################################
class MyFrame1 ( wx.Frame ):
def __init__( self, parent ):
wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
self.m_notebook1 = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_panel1 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
self.m_notebook1.AddPage( self.m_panel1, u"a page", False )
self.m_panel2 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
self.m_notebook1.AddPage( self.m_panel2, u"a page", False )
bSizer1.Add( self.m_notebook1, 1, wx.EXPAND |wx.ALL, 5 )
self.m_notebook2 = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_panel3 = wx.Panel( self.m_notebook2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
self.m_notebook2.AddPage( self.m_panel3, u"a page", False )
self.m_panel4 = wx.Panel( self.m_notebook2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
self.m_notebook2.AddPage( self.m_panel4, u"a page", False )
bSizer1.Add( self.m_notebook2, 1, wx.EXPAND |wx.ALL, 5 )
self.SetSizer( bSizer1 )
self.Layout()
self.Centre( wx.BOTH )
def __del__( self ):
pass