Icons Affecting Menu Style in wxPython on Windows 7
The following bit of code populates a class that inherits from the wx.Menu class, with menu items. So self is basically a wx.Menu. When I run the flowing code snippet, the line about.SetBitmap(wx.Bit开发者_StackOverflow社区map('Icon24.ico')) seems to change the highlighting from the default:
to this plain blue style:
The line about.SetBitmap(wx.Bitmap('Icon24.ico')) simply adds an icon (test). But, for some reason it changes the highlighting style. I know this is about as nitpicky as it gets, but I'd like to the first images highlighting style with the second images Icon. This is in Windows 7 if it makes a difference.
Snippet:
about = wx.MenuItem(self, -1, 'About...')
about.SetBitmap(wx.Bitmap('Icon24.ico')) # The line that's causing the problem.
itemlist = [self.AppendItem(about),
self.AppendSeparator(),
self.Append(-1, 'Options...'),
self.AppendSeparator(),
self.Append(-1, 'Exit')]
for i in itemlist:
self.Bind(wx.EVT_MENU, self.menu_beh, i)
Well, according to the WxWidgets doc, the version 2.8 doesn't support Windows Vista or 7, so I think this is expected since looks like it reset the entire menu theme to the XP style, I think the best you can try is to use the testing version 2.9, which support Vista (but not 7).
精彩评论