[wxPython-users] Printing and Toolbar status

Saketh Bhamidipati saketh.bhamidipati at gmail.com
Tue Jul 18 12:40:05 PDT 2006


On 7/18/06, Christopher Barker <Chris.Barker at noaa.gov> wrote:
>
>
>
> Saketh Bhamidipati wrote:
> > Second, the toolbar problem:
> >
> > I want the toolbar in my application to be optional through the main
> > menu and a right-click popup menu, so the following situation is what I
> > want, not what I have already written. Under 'Edit-Preferences' there is
> > a submenu with the checkable option "Toolbar" that toggles a flag
> > self.toolbarOn. If the option is checked, then the toolbar is displayed;
>
> >         # TODO: Make toolbar optional
> >         if self.toolbarOn:
> >             self.toolbar =3D toolbar =3D self.CreateToolBar()
>
> You may need to manage the toolbar yourself, rather than using
> wx.Frame.CreateToolBar(). Read this to see how:
>
> http://wiki.wxpython.org/index.cgi/WorkingWithToolBars
>
> Note that that is old style code! Don't copy that style! Myabe you could
> clean it up as your contribution....
>
> -Chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
> I have created a method which toggles the toolbar, but I have a slight
problem - where the toolbar used to be, there is now a gap. The rest of the
widgets do not fill in the area where the toolbar used to be. However, if I
explicitly call self.toolbar.Hide() in the application code, so that it is
executed before the application starts, then the toolbar is gone and the
widgets fill the frame in perfectly.

Here's the toggle method:

    def OnToggleStandardToolbar(self, e):

        if self.toolbarOn:
            self.toolbarOn =3D False
            self.toolbar.Hide()
            self.SetToolBar(None)

        elif not self.toolbarOn:
            self.toolbarOn =3D True
            self.toolbar.Show()
            self.SetToolBar(self.toolbar)

(self.toolbarOn is a flag so that I don't have to call isChecked.)

I don't know if self.Refresh() is necessary, but hiding the toolbar
explicitly before the application starts gets the result that I want.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200607=
18/f0464a24/attachment.htm


More information about the wxpython-users mailing list