You Are Here:

Community: Developer Discussion Boards

#1 Old PyS60 Ao_Timer and Active Objects/GUI Interaction - Works only less than 4 seconds - 2009-04-23, 16:00

Join Date: Apr 2009
Posts: 1
lwh007
Offline
Registered User
SOLUTION FOUND: It's not timer at all. Problem due to variable scope and lifetimes - correction shown below in red.

Don't you just love languages without explicit variable declarations....?

Unable to get Ao_timer to work with callback. Possibly due to something I don't understand about interaction between UI events, Ao_timer, and e32.Ao_lock() wait. Code works for 3 seconds and below, but nothing greater. Seems the timer only works if it expires while the GUI is still active.

#Running in PyS60 1.4.5 final
#Emulator S60 5th Edition SDK v 1.0
import appuifw
import e32
#
aTimer = e32.Ao_timer()
#Timer setting function
def menuMain():
data = appuifw.query(u"Seconds to Sleep?", "number")
#aTimer = e32.Ao_timer() VARIABLE LIFETIME ENDS WHEN def DONE!!
global aTimer
aTimer.after(data, aTimerRings)
appuifw.note(u"Timer set for " + str(data))
#e32.ao_yield() ##Does not seem to affect result
#
#Timer callback function
def aTimerRings():
appuifw.note(u"Ding!!!!", "info")
#e32.ao_yield() ##Does not seem to affect result
#
#Exit key handler
def exit_key_handler():
app_lock.signal()
#
#Houskeeping
appuifw.app.screen = "normal"
appuifw.app.menu = [(u"Main Menu", menuMain)]
app_lock = e32.Ao_lock()
t = appuifw.Text()
appuifw.app.body = t

#Run the program
appuifw.app.exit_key_handler = exit_key_handler
app_lock.wait()
Last edited by lwh007 : 2009-04-26 at 15:09.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d81449X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZpythonQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZuserE5ftagQSxpythonX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ