如何设置在 Windows 上切换任务时在 Alt-Tab 对话框中显示的应用程序图标?

发布于 2024-10-05 06:29:28 字数 585 浏览 0 评论 0原文

如何为 Windows 上的 wxpython 应用程序设置图标,使其在我在应用程序之间切换时显示在 Alt-Tab 对话框中?

菜单栏中的应用程序图标和正在运行的应用程序的一角显示了我的图标,但是当我使用 Alt-Tab 在应用程序之间切换时,我可以看到带有蓝色轮廓图标的默认方块。

我是否需要做一些额外的事情才能使我的图标显示在 Alt-Tab 对话框中,或者我的图标是否必须包含特殊分辨率?

在我的类初始值设定项中,我设置图标:

class A(wx.Frame):
    def __init__(self,parent,id,title):
        wx.Frame.__init__(self,parent,-1,title,size=(265,434))
        favicon = wx.Icon('C:\source\python\gui\gf.ico',
                           wx.BITMAP_TYPE_ICO, 16,16)
        wx.Frame.SetIcon(self,favicon)

How do I setup icon, for wxpython application on Windows, that shows up in the Alt-Tab dialog when I'm switching between applications?

The application icon in the menu bar and the corner of the running app shows my icon but when I switch between applications using Alt-Tab I can see the default square with blue outline icon.

Do I need to do something extra for my icon to show up in Alt-Tab dialog or does my icon have to include a special resolution?

In my class initializer I setup icon :

class A(wx.Frame):
    def __init__(self,parent,id,title):
        wx.Frame.__init__(self,parent,-1,title,size=(265,434))
        favicon = wx.Icon('C:\source\python\gui\gf.ico',
                           wx.BITMAP_TYPE_ICO, 16,16)
        wx.Frame.SetIcon(self,favicon)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

全部不再 2024-10-12 06:29:28

这对我有用:

self.icon = wx.Icon(fn, wx.BITMAP_TYPE_ICO)
self.SetIcon(self.icon)

fn 中的图标有多种分辨率(我认为是 16、32 和 48)。

看起来您至少想更改

    wx.Frame.SetIcon(self,favicon)

    self.SetIcon(favicon)

另外,尝试从 wx.Icon 调用中删除 16 并确保您的图标具有其他分辨率。

This works for me:

self.icon = wx.Icon(fn, wx.BITMAP_TYPE_ICO)
self.SetIcon(self.icon)

where the icon in fn has several resolutions (16, 32, and 48, I think).

Looks like you at least want to change

    wx.Frame.SetIcon(self,favicon)

to

    self.SetIcon(favicon)

Also, try removing the 16's from the wx.Icon call and making sure your icon has other resolutions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文