I'm aware this might be a dumb question, but I can't figure out how to translate this simple Swift statement (didn't find an Objective-C example) into pyobjc:
let calendars = EventStore.calendars(for entityType:.Events)
What I got so far (trying out different options):
from EventKit import EKEventStore
ek_event_store = EKEventStore.alloc().init()
default_cal = ek_event_store.defaultCalendarForNewReminders() # works, but not the calendar I wish to access
my_cal_identifier = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
my_cal = ek_event_store.calendar(my_cal_identifier)) # Error: 'EKEventStore' object has no attribute 'calendar'
calendars = ek_event_store.calendars() # value is None. I don't know how to pass it the entityType
So I guess my problem is not knowing
- what the entityType is supposed to be (type? value?)
- how to pass the entityType to the calendars function.
I figured it out (using the dir function on the event store object and on a calendar object)
I didn't find the Event types in the documentation, but with trial and error, I figured it out:
So I also gained some better insight how pyobjc is working:
EventStore.calendars(for entityType:.Events)becomesEventStore.calendardsForEntityType(event_type).I was also wondering why the "calendar" function could not be found, now I understand that it bacame calendarWithIdentifier in pyobjc.