Hi,
I'm trying to understand one of the wiki wxPython tutorial, and I must
admit I`m a bit baffled by sizers. If I run the following relevant
piece of code, I get the result I expect, i.e a 800x600 window being
opened (sorry for the formatting):
objFrame = MainWindow(None , -1, "Small Editor", (800, 600))
def __init__(self, parent, id, title, custom_size):
wx.Frame.__init __(self, parent, wx.ID_ANY, title, size =
custom_size,
style = wx.DEFAULT_FRAM E_STYLE |
wx.NO_FULL_REPA INT_ON_RESIZE)
However, if I add this part from the tutorial, I get a much smaller
window. Why is there an interference with the result I want when
adding the sizer code?
Here's the code:
# Sizer section to understand
self.sizer2 = wx.BoxSizer(wx. HORIZONTAL)
self.buttons = []
for nI in range(0, 6):
self.buttons.ap pend(wx.Button( self, ID_BUTTON + nI, "Button &" +
`nI`))
self.sizer2.Add (self.buttons[nI], 1, wx.EXPAND)
self.sizer = wx.BoxSizer(wx. VERTICAL)
self.sizer.Add( self.control, 1, wx.EXPAND)
self.sizer.Add( self.sizer2, 0, wx.EXPAND)
self.SetSizer(s elf.sizer)
self.SetAutoLay out(1)
self.sizer.Fit( self)
# End of sizer section
Thanks
Denis
I'm trying to understand one of the wiki wxPython tutorial, and I must
admit I`m a bit baffled by sizers. If I run the following relevant
piece of code, I get the result I expect, i.e a 800x600 window being
opened (sorry for the formatting):
objFrame = MainWindow(None , -1, "Small Editor", (800, 600))
def __init__(self, parent, id, title, custom_size):
wx.Frame.__init __(self, parent, wx.ID_ANY, title, size =
custom_size,
style = wx.DEFAULT_FRAM E_STYLE |
wx.NO_FULL_REPA INT_ON_RESIZE)
However, if I add this part from the tutorial, I get a much smaller
window. Why is there an interference with the result I want when
adding the sizer code?
Here's the code:
# Sizer section to understand
self.sizer2 = wx.BoxSizer(wx. HORIZONTAL)
self.buttons = []
for nI in range(0, 6):
self.buttons.ap pend(wx.Button( self, ID_BUTTON + nI, "Button &" +
`nI`))
self.sizer2.Add (self.buttons[nI], 1, wx.EXPAND)
self.sizer = wx.BoxSizer(wx. VERTICAL)
self.sizer.Add( self.control, 1, wx.EXPAND)
self.sizer.Add( self.sizer2, 0, wx.EXPAND)
self.SetSizer(s elf.sizer)
self.SetAutoLay out(1)
self.sizer.Fit( self)
# End of sizer section
Thanks
Denis
Comment