[wxPython-users] toolbar sizers???

Wojtek P wojtulek at gmail.com
Wed Apr 4 03:01:53 PDT 2007


You can use wxSashWindow (SashWindow.py in demo for example). I use
wxSashWindow for frame:

win =3D wx.SashLayoutWindow(self, -1, style=3Dwx.NO_BORDER)
win.SetDefaultSize((1000, 25))
win.SetOrientation(wx.LAYOUT_HORIZONTAL)
win.SetAlignment(wx.LAYOUT_TOP)

and then put in class MyToolbar derived from wxPanel:


class MyToolBar(wx.Panel):
    def __init__(self, parent):
        self.tbHeight =3D 25
        wx.Panel.__init__(self, parent, id=3D-1, pos=3D(0,0), size=3D(0,0),=
 style=3D
wx.SIMPLE_BORDER)
        self.tbSizer =3D wx.BoxSizer(wx.HORIZONTAL)
        self.SetSizer(self.tbSizer)
        self.minWidth =3D 0
        self.spacer =3D None
        self.toolSeparation =3D 2 # default

and declare some toolbar methods...

    def AddControl(self,control, proportion=3D0, flag=3Dwx.LEFT, border=3D0=
):
        control.Reparent(self)
        flag =3D flag | wx.ALIGN_CENTER_VERTICAL
        if border=3D=3D0:
            border =3D self.toolSeparation
        self.tbSizer.Add(control, proportion, flag, border)

w.p.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200704=
04/52bf4950/attachment.htm


More information about the wxpython-users mailing list