PDA

View Full Version : [SOLVED] wxPython "close" menu item icon



suprfish
September 6th, 2008, 09:57 PM
Currently learning the ins-and-outs of wxPython. I've run into a little problem and I can't find any docs about it: using wxPython, how can I make a "close" menu item which uses whatever icon the theme is supposed to?



file = wx.Menu()
file.Append(11, '&Close\tCtrl+W')


I'm sure there is something built in to wxWidgets, but I can't find it. Thanks for any help :)

StOoZ
September 6th, 2008, 10:12 PM
well , I use wxwidgets in C++ , but I guess the concept is quite the same.
append to the wxmenu , a wxmenu item , which you then you set its icon with wxMenuItem::SetBitmap :
http://docs.wxwidgets.org/stable/wx_wxmenuitem.html#wxmenuitemsetbitmap

I never used that function , I like my menu items without any graphics. (-:

suprfish
September 6th, 2008, 10:20 PM
Thanks, but what if, for example, the user has set their environment to use a specific icon theme? How can I use whatever that theme says I should use as the "close" icon? I feel like there's some standard way to do it that I'm missing.

suprfish
September 6th, 2008, 11:25 PM
(bump)

suprfish
September 6th, 2008, 11:39 PM
Got it, it's


file.Append(wx.ID_EXIT, '&Close\tCtrl+W')

which makes sense, but I couldn't find any documentation on it so I did a search on google code...

StOoZ
September 7th, 2008, 05:21 AM
I think its not what I meant to do in the first place.
:)