Categories: S60 | Python | Code Examples
This page was last modified 14:59, 19 March 2007.
A simple timeout application
From Forum Nokia Wiki
Remind yourself of how fast time fly with this application. You should change the sound file to the one you like.
from appuifw import * from key_codes import * from graphics import Image from audio import * import e32, miso def change_duration(): global duration answer = query(u'How long?', 'time', 18000.0) if answer: duration = int(answer/60) if duration <= 200: if query(u'Change to hr:min ?', 'query'): duration *= 60 im = Image.new((60,48)) def showtime(rect=None): im.clear() im.text((5,28), u"%02d:%02d" % divmod(duration,60), font='title') c.blit(im, target=(0,0,180,144), scale=1) # triple size duration = 300 running = 0 app.body = c = Canvas(showtime) alert = Sound.open(u'Z:\\Nokia\\Sounds\\Digital\\Cuckoo.awb') showtime() def start(): global duration, running running = 1 while running: duration -= 1 showtime() if duration <= 0: alert.play(-2) # repeat play break if duration % 10 == 0: miso.reset_inactivity_time() e32.ao_sleep(1) def toggle(): global running if alert.state() == EPlaying: alert.stop() return running = 1 - running if running: start() def quit(): global running running = 0 if alert.state() == EPlaying: alert.stop() lock.signal() lock = e32.Ao_lock() c.bind(EKeySelect, toggle) # start, pause, resume app.menu = [(u'Duration', change_duration),(u'Close', quit)] app.exit_key_handler = quit lock.wait()
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to disconnect Bluetooth link? | jhnlmn | Bluetooth Technology | 1 | 2007-06-25 04:09 |
| Simple Encryption | b0ssY | General Symbian C++ | 2 | 2007-08-17 10:01 |
| "Application Error!" on one 6600 but fine on an older 6600. Eh? | MikeC_UK | Mobile Java General | 5 | 2006-04-04 09:15 |
| HELP!! create a connection b/w cell phone and laptop | humaali | Mobile Java Networking & Messaging & Security | 2 | 2006-02-15 18:18 |
| Simple text input field | erst | General Symbian C++ | 15 | 2007-04-03 06:11 |
