Namespaces
Variants
Actions
(Redirected from How to use calendar)

Archived:How to use calendar in PySymbian

Jump to: navigation, search
Archived.png
Aquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.

All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.
Article Metadata

Compatibility
Platform(s): S60 2nd Edition, S60 3rd Edition

Article
Keywords: calender
Created: cyke64 (15 Mar 2007)
Last edited: hamishwillee (31 May 2013)

Overview

Python provides calendar module where you can manipulate your Calendar and Todo items. Many item types (called entry) are contained in the calendar :

  • Appointment
  • Event
  • Anniversary
  • Todo

There is also a TodoList type to group each TodoEntry into many lists.

Code

import time, calendar  # import modules
now = time.time() # Get current date and time
cal = calendar.open() # Open Calender
 
day_all = cal.daily_instances(now) # all entries today
# if you specify any of the 4 types, it will show only those
month_ev = cal.monthly_instances(now, events=1) # events this month
 
# search for keyword within duration
jan01 = mktime((2005,1,1, 0,0,0, 0,0,0))
first_km = cal.find_instances(jan01, now, u'km')[0] # first in this year
 
# display entry information
e = cal[first_km['id']] # or use any entry found above
print e.type, strftime('%b %d %H:%M', localtime(e.start_time))
print e.content, '(', e.location, ')'
# other properties are id, last_modified, priority, alarm,
# replication, crossed_out, and end_time
 
# add new appointment
a = cal.add_appointment()
a.content = 'urgent meeting'
a.set_time(now, now) # start and end time
a.commit()
This page was last modified on 31 May 2013, at 04:05.
161 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved