在Windows 7上影响wxPython菜单样式的图标

时间:2011-03-10 08:34:22

标签: python windows-7 menu wxpython highlighting

以下代码填充了一个继承自 wx.Menu 类的类,其中包含菜单项。所以 self 基本上是wx.Menu。当我运行流动的代码片段时,行 about.SetBitmap(wx.Bitmap('Icon24.ico'))似乎会更改默认突出显示:

enter image description here

这种朴素的蓝色风格:

enter image description here

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)

1 个答案:

答案 0 :(得分:1)

嗯,根据WxWidgets文档,版本2.8不支持Windows Vista或7,所以我认为这是预期的,因为看起来它将整个菜单主题重置为XP风格,我认为你可以尝试的最好是使用测试版2.9,它支持Vista(但不支持7)。