ms7m / notify-py

:speech_balloon: | A simple Python Module for sending cross-platform desktop notifications on Windows, macOS and Linux
MIT License
262 stars 26 forks source link

TypeError: WindowsNotifier.__init__() got an unexpected keyword argument 'default_application_name' #46

Closed LucasNiesen closed 1 year ago

LucasNiesen commented 2 years ago

I tried this code but it doen't work. image

LucasNiesen commented 2 years ago

Is there a temporary fix for this?

ms7m commented 2 years ago

I'll push out a fix for this, but a quick way to fix this is to use the WindowsNotifier.send_notification method directly. This would only work out if you know your target platform is windows.

LucasNiesen commented 2 years ago

I'll push out a fix for this, but a quick way to fix this is to use the WindowsNotifier.send_notification method directly. This would only work out if you know your target platform is windows.

But how can i change the name? image

ms7m commented 2 years ago

You can pass application_name parameter to WindowsNotifier.send_notification with the name you'd like.

LucasNiesen commented 2 years ago

You can pass application_name parameter to WindowsNotifier.send_notification with the name you'd like.

Like this ? image

ms7m commented 2 years ago

I'm not near a windows computer to verify but you should be able to do something like this:

from notifypy.os_notifiers.windows import WindowsNotifier

WindowsNotifier().send_notification(
        notification_title="Sample Title",
        notification_subtitle="Sample Subtitle",
        notification_icon="path_to_icon.ico",
        application_name="Goat IM",
        notification_audio="path_to_audio.mp3",
)

lmk if it works out for you.

LucasNiesen commented 2 years ago

The sound works but i dont see any message on my screen. image

ms7m commented 2 years ago

Might be an issue with the latest versions of Windows -- I won't be back near my desk until the end of the day. I'll take a look at then.

LucasNiesen commented 2 years ago

Might be an issue with the latest versions of Windows -- I won't be back near my desk until the end of the day. I'll take a look at then.

So i tried it on win 10 21H2 and win 11 21H2 but it doesn't work on both.

mniesen commented 2 years ago

I tried this code but it doen't work. image

Changing default_application_name to default_notification_application_name works for me after running function your_function.

Code looks like:

from notifypy import Notify

notification = Notify(
    default_notification_title="Function Message",
    default_notification_application_name="Great Application",
    default_notification_icon="test.ico"
)

def your_function():
  # stuff happening here.
  notification.message = "Function Result"
  notification.send()

your_function()

In the README.md file the example used default_application_name, this give me an error as well.