[melbourne-pug] Simple syntactic error?

John La Rooy john.larooy at gmail.com
Thu May 22 21:42:57 CEST 2008


Are you getting an AttributeError in keys() or is state just None.
It looks like cb_calling needs to declare state as global

def cb_calling(args):
   global state
   state = args[0]

On Fri, May 23, 2008 at 5:10 AM, g sobers <g.forumz at gmail.com> wrote:

> G'day!
>
> Following is a small PyS60 script. The error seems related to basic syntax
> - "state" in keys() is not recognized although defined globally.
>
> Would appreciate assistance.
>
> =============================================
> import appuifw, key_codes, e32, telephone
> state = None
>
> def keys(event):
>    if event['keycode'] == key_codes.EKeyYes:
>      appuifw.note(u"Doesn't Matter")
>   elif (event['keycode'] == key_codes.EKeyYes) and (state ==
> telephone.EStatusConnected):
>      appuifw.note(u"Yes was pressed and call active")
>
> def cb_calling(args):
>    state = args[0]
>
> def quit():
>    app_lock.signal()
>
> telephone.call_state(cb_calling)
> canvas = appuifw.Canvas(event_callback = keys)
> appuifw.app.body = canvas
> appuifw.app.exit_key_handler = quit
> app_lock = e32.Ao_lock()
> app_lock.wait()
> ==============================================
>
> Best,
> wirefree
>
> _______________________________________________
> melbourne-pug mailing list
> melbourne-pug at python.org
> http://mail.python.org/mailman/listinfo/melbourne-pug
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/melbourne-pug/attachments/20080523/2d70abe6/attachment.htm>


More information about the melbourne-pug mailing list