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

Tim Roberts timr at probo.com
Wed Nov 1 09:41:58 PST 2006


On Tue, 31 Oct 2006 19:42:21 +0000, Alun Griffiths
<alun.griffiths at 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.


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.

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





More information about the wxpython-users mailing list