473,386 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

XRC, wxMenuBar's, and wxMenuBarPtr's

I have an XRC file that contains a complete menubar. I load this
menubar into a frame with:

self.ResMenu = wxXmlResource("menus.xrc",0)
self.MenuBar = self.ResMenu.LoadMenuBar("MenuBarEditor")
self.SetMenuBar(self.MenuBar)

Then set up a menu event handler:

EVT_MENU(self, XRCID("MenuItemSnapToGrid"), self.OnSnapToGrid)

Finally, in OnSnapToGrid, I try to get a specific wxMenuItem by using
the wxMenuBar.FindItem:

m = self.MenuBar.FindItem(XRCID("MenuItemSnapToGrid"))

This falls flat on its face because:

AttributeError: wxMenuBarPtr instance has no attribute 'FindItem'

It seems that LoadMenuBar returns a wxMenuBarPtr rather than a
wxMenuBar. My question then is given a wxMenuBarPtr and the ID of the
menu-item (via XRCID), how do I get ahold of the wxMenuItem object?
Alternativly, is there a way to check/uncheck a wxMenuItem without
having a reference to the actual object (using the id or similar)?

Thanks in advance,

Mark Moss
Jul 18 '05 #1
0 1214

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: RJS | last post by:
Hi all, I can't get a py2exe compiled app to run with numarray (numarray-0.5.win32- py2.2). Also wxPythonWIN32-2.3.3.1-Py22 and ActivePython-2.2.1-222. In the sample below, commenting out...
1
by: Curzio Basso | last post by:
Hi all, I have a problem for which I wasn't able to find an answer anywhere else, maybe someone can give me a hint... I designed with XRCed a small GUI (the code is at the bottom of the...
1
by: flupke | last post by:
Hi, i'm trying to convert my java console app to a python gui. Now, the only problem i seem to have at the moment are the resizers for the layout. It seems that for the purpose of what i'm...
6
by: OKB (not okblacke) | last post by:
I've started taking a look at wxPython, and, well, I've noticed that the syntax needed to code with it is extremely ugly. I am wondering if there exist any preprocessing tools or clever...
1
by: marchew | last post by:
hi, i have a problem integrating wxPython and Twisted under Win32. my application consumes 40-50% of CPU resources when wxFrame is visible and reactor (twisted) is running. i looked at...
0
by: Scott | last post by:
I have the code below. I have changed the background of the frame to white, but I cannot get the wxSlider to not be the ugly gray color. Can someone tell me how to change it to a transparent...
0
by: Alex Nordhus | last post by:
I need some help. I cant seem to get rid of this error. I can program a button that will exit the program and remove the icon in the taskbar, but I have to tie it to OnTaskBarClose. OnExit and...
1
by: linuxfreak | last post by:
Hi all, I have a problem. I want to add items to a Menu iteratively and I'm stuck. Heres a snippet of my code fileMenuChoices= ...... ...... ......
2
by: rodmc | last post by:
I am totally new to Python and WxPython and need to write an application which can open up an external windows from a plug-in within GAIM (using pyGAIM). I have managed to hack some code together...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.