Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Revision as of 01:10, 31 May 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Archived:Simple PySymbian alarm clock for S60 5th Edition

From Wiki
Jump to: navigation, search

Archived.pngAquivado: 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
S60 5th Edition
Created: croozeus (14 Oct 2008)
Last edited: hamishwillee (31 May 2013)



Here is a small code snippet which creates a Alarm Clock in Python.This application is designed to make an alert sound at a specific date and/or time. The application is tested on S60 5th Edition SDK but the code below can also be used with S60 5th Edition pre-releases (some changes might be required for porting). Learn how to use PySymbian with 5th Edition SDK here: Archived:PySymbian for 5th Edition with sample applications.

Code Snippet

Below is the code snippet for Alarm clock application.

import e32
import time
import appuifw
def quit():
def play_sound():
from audio import *
f = 'C:\\Nokia\\Sounds\\Digital\\28050.amr'
s = sound file sound file
def alarm(): #function to compare time.
def wait():
t = list(time.localtime())
n = time.mktime(t)
t[3] = t[4] = t[5] = 0
t[2] += 1
return time.mktime(t) - n
w = wait()
while w > 60:
h = w / 3600
m = w % 3600 / 60
s = w % 60
print "Alarm on !"
print "waiting %02d:%02d:%02d ..." % (h, m, s)
timer.after(s or 60)
w = wait()
appuifw.note(u"Alarm time" + unicode(note)) #display note on alarm
play_sound() #play sound on alarm
tx.font=u"Nokia Hindi S6017" # specify font = appuifw.STYLE_BOLD
tx.clear() #Clear the window
tx.add(u"The Current Time is "+ unicode(time.localtime())
tx.add(u"\n >Click options to set new alarm")[(u'Quick Alarm', alarm),(u'Exit', quit)] # Set menu options


Alarm 5thSDK.jpg

Further Development

A lot of improvements can be done to the code presented in this article. For example,

  • The graphics of the application can be customized using the graphics module.
  • A topwindow or a pop-up alert could be added.

See Also

Archived:PySymbian for 5th Edition with sample applications

This article is authored by croozeus 14:03, 14 October 2008 (EEST)

This page was last modified on 31 May 2013, at 01:10.
43 page views in the last 30 days.