RE: [Pythoncard-users] how to set menu item label?
by Kevin Altis other posts by this author
May 9 2002 4:24PM messages near this date
RE: [Pythoncard-users] how to set menu item label?
|
[Pythoncard-users] Re: ZwikiCard (was [PythonCard Users] Intro)
> From: David Primmer
>
> Problems with this. Second time through it breaks. If I rename the menu
> label I can't find it again with your getMenuId call. If you try to find
> that menuitem again it's gone
>
> >>> id = bg.menuBar.getMenuId('menuFileExit')
> >>> id
> -1
>
> I wrote work-around code to get the menuid once at startup and then I
> re-use it but shouldn't this getMenuID call work after the label is
> changed?
Yep, this is a bug. If you look at menu.py you'll see that it is doing a
string search on the menu. I don't want to try and work around this now,
there is too much risk of breaking something else. Rewriting menu.py to use
direct sub-classes is high on my priority list, so I'll fix it in June. Just
save the id for now.
ka
> > -----Original Message-----
> > From: pythoncard-users-admin@[...].net [mailto:pythoncard-
> > users-admin@[...].net] On Behalf Of Kevin Altis
> > Sent: Monday, May 06, 2002 9:30 PM
> > To: pythoncard-Users
> > Subject: RE: [Pythoncard-users] how to set menu item label?
> >
> > > From: David Primmer
> > >
> > > I'm trying to use self.menuBar.setLabel but apparently it's not
> > > supported. How do I set a menu label other than making my menus
> directly
> > > in wxPython?
> >
> > I still need to refactor menu.py so it uses direct subclasses of
> > wxPython's
> > menu classes, so this is a short-term hack. Basically you need the
> menu id
> > and then you can just use wxPython. Here's an example done in the
> shell
> > with
> > the minimal sample.
> >
> > >>> id = bg.menuBar.getMenuId('menuFileExit')
> > >>> id
> > 162
> > >>> mbar = bg.GetMenuBar()
> > >>> mbar.SetLabel(id, 'Goodbye')
> >
> > So, you use getMenuId() with the name of the menu you're interested in
> to
> > get its id ('menuFileExit' in the example above) and after that it is
> all
> > wxPython methods (GetMenuBar and SetLabel).
> >
> > In your code, you'll use 'self' instead of 'bg'.
> >
> > ka
> >
> >
> > _______________________________________________________________
> >
> > Have big pipes? SourceForge.net is looking for download mirrors. We
> supply
> > the hardware. You get the recognition. Email Us:
> bandwidth@[...].net
> > _______________________________________________
> > Pythoncard-users mailing list
> > Pythoncard-users@[...].net
> > https://lists.sourceforge.net/lists/listinfo/pythoncard-users
>
>
> _______________________________________________________________
>
> Have big pipes? SourceForge.net is looking for download mirrors. We supply
> the hardware. You get the recognition. Email Us: bandwidth@[...].net
> _______________________________________________
> Pythoncard-users mailing list
> Pythoncard-users@[...].net
> https://lists.sourceforge.net/lists/listinfo/pythoncard-users
>
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: bandwidth@[...].net
_______________________________________________
Pythoncard-users mailing list
Pythoncard-users@[...].net
https://lists.sourceforge.net/lists/listinfo/pythoncard-users
Thread:
David Primmer
Kevin Altis
David Primmer
Kevin Altis
|