[Urwid] On key press, handler function is executing continuously(infinitely)

Muhammad Ammar mammar at gmail.com
Wed Jul 28 02:56:01 EDT 2010


Hi All,

Following is a snippet of code from my application. The problem is that when
i pressed the 'f12' key function "PrintAllRecords" is executing continuously
like "PrintAllRecords" is being called in an infinite loop. The issue is
random. Anyone have any idea?

def OnKeyPress(self, key):
>
>         if self.lockKeys:
>             return
>
>         if key == 'esc':
>             self.Exit()  #reboot or shutdown
>
>         elif key == 'f12':
>             self.lockKeys = True
>             self.PrintAllRecords()
>             self.lockKeys = False
>
>
> def main(self):
>     self.init()
>     self.loop = urwid.MainLoop(self.view, palette,
> unhandled_input=self.OnKeyPress)
>
>
> if __name__ == "__main__":
>
>     GUI().main()
>

Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.excess.org/pipermail/urwid/attachments/20100728/c8de02fb/attachment.htm 


More information about the Urwid mailing list