影响 Windows 7 上 wxPython 菜单样式的图标
下面的代码使用菜单项填充一个继承自 wx.Menu 类的类。所以self基本上是一个wx.Menu。当我运行流动的代码片段时,行 about.SetBitmap(wx.Bitmap('Icon24.ico')) 似乎更改了默认的突出显示:
为纯蓝色样式:
行 about.SetBitmap(wx.Bitmap('Icon24.ico')) 只是添加一个图标(测试)。但是,由于某种原因它改变了突出显示的样式。我知道这有点挑剔,但我希望第一张图像与第二张图像图标一起突出显示风格。如果它有所不同的话,那就是在 Windows 7 中。
片段:
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)
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.Bitmap('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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,根据 WxWidgets 文档,2.8 版本不支持 Windows Vista 或 7,所以我认为这是预期的,因为看起来它将整个菜单主题重置为 XP 风格,我认为你可以尝试的最好方法是使用测试版本2.9,支持Vista(但不支持7)。
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).