wxPython-users Digest 1 Nov 2006 11:28:27 -0000 Issue 1715

Dialog item IDs in Windows are limited to 16 bits. 100001 is larger
than 16 bits. I think you got the root cause of your problem earlier
(using the wrong API), but this is something to remember. 100001 will
clash with 34465.

···

On Tue, 31 Oct 2006 19:42:21 +0000, Alun Griffiths <alun.griffiths@dsl.pipex.com> wrote:

I have a menu defined in a frame and need to enable/disable some of
the menu items as the user adds/deletes data while the program is
executing. The code snippet is as follows:
...
I thought that setting the menu item IDs explicitly would allow me to
"get at" them later on using FindItemById(). However, Python gives
the error

'NoneType' object has no attribute 'Disable'

when it meets the line edit_city.Disable() so I guess that means that
it has not been able to find the window whose ID is 100001 (ie "edit
city" menu item) the even though I set this when TopFrame was
constructed. Hmm.... I had a look at the WXWIDGETS website and found
that wxMenuItem is not derived from wxWindows which I guess is the
reason why I'm getting the error.

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Tim Roberts wrote:

Dialog item IDs in Windows are limited to 16 bits. 100001 is larger
than 16 bits.

another good reason NOT to use explicit IDs -- let them be an internal implementation detail.

If you really do have a good reason to use them (there may be one -- I just haven't encountered it yet), let wx generate it for you:

ID = wx.NewID()

....

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov