Panel problems

ebbyfish at gmail.com ebbyfish at gmail.com
Sun Mar 27 12:38:52 EST 2005


Howdy,
I am having some problems woth sizers adding panels to a
scrolledwindow.

I have 3 classes (wx.Panels) which I want to add to a ScrolledWindow
(The Parent). I can get it to work except the ScrollWindow never
scrolls.


Also as I am new to (wx)Python, so I am sure it is a simple mistake.
But what I cannot figure out is the creation order of Frames to Panels
to Windows, sizers, blah...Is this infomation laid out some where?

Any help would be apperciated.


class MyFrame(wx.Frame):
    def __init__(self, parent, ID, title):
        wx.Frame.__init__(self, parent, ID, title,
                        style=wx.DEFAULT_FRAME_STYLE
                        | wx.CLIP_CHILDREN
                        | wx.NO_FULL_REPAINT_ON_RESIZE)

        self.MaintPanel = wx.ScrolledWindow(self, -1,
                           style=wx.SUNKEN_BORDER
                           | wx.CLIP_CHILDREN)
        self.MaintPanel.SetScrollRate(10, 10)

        # Do I need another Sizer in here somewhere??

        #Parent Sizer
        #self.mainsizer = wx.BoxSizer(wx.VERTICAL)
        #self.SetSizer(self.mainsizer)
        #self.SetSize(( 700, 600 ))
        #self.Centre()

        self.subsizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(self.subsizer)
        self.SetSize(( 700, 600 ))
        self.Centre()

        # Add subPanels
        # All of the sub panels work fine
        pnl1 = subPanel1(self)
        pnl2 = subPanel2(self)
        pnl3 = subPanel3(self)

        self.subsizer.AddMany([ (pnl1, 1, wx.EXPAND),
                                (pnl2, 1, wx.EXPAND),
                                 (pnl3, 1, wx.EXPAND)])

        # Add Main Panel
        self.MaintPanel.SetAutoLayout(True)
        self.MaintPanel.SetSizer(self.subsizer)
        
        self.Layout()

Thanks in advance
Scott




More information about the Python-list mailing list