jithurjacob / Windows-10-Toast-Notifications

Python library to display Windows 10 Toast Notifications
MIT License
970 stars 168 forks source link

Size of icon in notification #46

Closed not-sekiun closed 2 years ago

not-sekiun commented 5 years ago

When i am displaying an icon in the notification it appears to be quite small no matter what size/resolution icon file i have. Is there a way to make the icon appear bigger in the notification?

domdfcoding commented 5 years ago

I'd like to know the answer to this too. The example image in the readme shows a larger icon, so I assume it's possible

robertgr991 commented 5 years ago

The size of the icon should be changed from here:

hicon = LoadImage(self.hinst, icon_path, IMAGE_ICON, 0, 0, icon_flags)

The first 0 is the width in pixles, the second 0 is the height in pixels. However, it didn't worked for me so it's not a guarantee that it will work for others, but that's the place where the size should be provided.

You can see more about the parameters of the LoadImage function here: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadimagea

Edit:

After trying different things, I noticed that adding a certain flag makes the icon bigger, but I don't know if this is the intended behavior. To achieve this import the flag:

from win32gui import NIIF_ICON_MASK

Then add it here:

Shell_NotifyIcon(NIM_MODIFY, (self.hwnd, 0, NIF_INFO, WM_USER + 20, hicon, "Balloon Tooltip", msg, 200, title, NIIF_ICON_MASK))

@domdfcoding @angus-y