from plyer import notifications
class Reminder():
def __init__(self,message = None):
if not message:
message = input("Please enter the message: ")
self.message = message
print(self.message)
def sendNotification(self):
print(self.message)
notification.notify(title = "Python reminder", message = self.message, app_name = "Python reminder program",app_icon = "",timeout = 10,ticker = "this is ticker thing")
def getTime(self):
pass
Reminder.sendNotification("message")
The error that I am getting is as follows:
Traceback (most recent call last): File "c:/Users/yomamahahaha/Desktop/oooohackrrr/actual programs/python/Reminders/reminder.py", line 28, in Reminder.sendNotification("kek") File "c:/Users/yomamahahaha/Desktop/oooohackrrr/actual programs/python/Reminders/reminder.py", line 20, in sendNotification print(self.message) AttributeError: 'str' object has no attribute 'message'
You don't create an instance of Reminder
so when you call
Reminder.sendNotification("message")
You're setting 'self' as "message" here: Then calling "message".message
, which doesn't exist
def sendNotification(self):
print(self.message)
I think you mean
myReminder = Reminder("Message")
myReminder.sendNotification()