Re: Menu.Append/AppendSubMenu question
Andrea Gavana <[email protected]>
| Newsgroups | gmane.comp.lib.wxwindows.general |
|---|---|
| Message-ID | <CAEf70bxyRXC=iKkH5=KRO30mvemuEVMrnjR0EZ2xuE_YvquOwg@mail.gmail.com> |
On Wed, 5 Mar 2025 at 05.22, 'raf' via wx-users <[email protected]> wrote: > Hi, > > I've just started converting a > python-2.7/wxpython-2.8.12.1 app to > python-3.12/wxpython-4.2.2. > > The first API change that I've run into is > Menu.Append(). It looks like it used to have > parameters: id, text, help (at least they were the ones > I used - there are others). And the names have changed > to: id, item, helpString. > > That's fine. but when I look at: > > https://docs.wxpython.org/wx.Menu.html#wx.Menu.Append > > It says: > > Deprecated This function is deprecated, use AppendSubMenu instead. > > AppendSubMenu seems like a unfortunate name for a > function that adds a menuitem with no submenu, but I > assume I can just pass it submenu=None and that'll be > OK (although the docs are very brief and don't state > whether this will be OK or not) > > But more importantly, AppendSubMenu doesn't take an id > parameter. > > How do I pass it the Id? I also at some point saw > deprecation warnings for NewId(). And looking into it, > it seems that I need to replace all my uses of NewId() > with NewIdRef(), but if I have to use AppendSubMenu(), > which doesn't accept an id parameter, what am I > supposed to do? > > I do reuse ids when the same functionality appears in > multiple places within the menu. > > Thanks for any advice you might have. > > cheers, > raf > The documentation is messed up, at least visually. As far as I know, Append() is deprecated only if you want to append a submenu to a menu - for which you should use AppendSubMenu(). For a standard wx.MenuItem it should work without problems and without DeprecationWarnings. Andrea. > -- > Please read https://www.wxwidgets.org/support/mlhowto.htm before posting. > --- > You received this message because you are subscribed to the Google Groups > "wx-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion visit > https://groups.google.com/d/msgid/wx-users/Z8fRdHoVyj0oGRC6%40raf.org. > -- Please read https://www.wxwidgets.org/support/mlhowto.htm before posting. --- You received this message because you are subscribed to the Google Groups "wx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/wx-users/CAEf70bxyRXC%3DiKkH5%3DKRO30mvemuEVMrnjR0EZ2xuE_YvquOwg%40mail.gmail.com.