Skip to content

Adding a calendar notification #281

Answered by N-Coder
ChopsKingsland asked this question in Q&A
Discussion options

You must be logged in to vote

See here, which will show you how to add an alarm to a single event. There is no "automated" way to set some alarms by default, but you can simply add the alarm to all events that don't have one set before writing out the calendar:

for event in c.events:
    if not event.alarms:
        event.alarms = [DisplayAlarm(trigger=timedelta(hours=-2))]
with open('my.ics', 'w') as my_file:
    my_file.writelines(c)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ChopsKingsland
Comment options

@N-Coder
Comment options

Answer selected by N-Coder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #280 on March 14, 2021 10:36.