Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup application icon that shows up in Alt-Tab dialog when switching tasks on Windows?

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)
like image 984
stefanB Avatar asked Nov 29 '25 08:11

stefanB


1 Answers

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.

like image 98
gaefan Avatar answered Nov 30 '25 22:11

gaefan