FAQ
Newbie here, so apologies for the obvious, but am I doing something wrong?




The following traceback and happens when Alerts.confirm() is called
running on win7
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]
on win32


-----------------------------------


Traceback (most recent call last):
   File "C:\Python27\lib\site-packages\GUI\Component.py", line 232, in
_win_event_message
     pass_message = not self._event_custom_handled(event)
   File "C:\Python27\lib\site-packages\GUI\MessageHandler.py", line 112, in
_event_custom_handled
     self.handle_event(event)
   File "C:\Python27\lib\site-packages\GUI\MessageHandler.py", line 40, in
handle_event
     self.handle(event.kind, event)
   File "C:\Python27\lib\site-packages\GUI\MessageHandler.py", line 59, in
handle
     method(*args)
   File "C:\Python27\lib\site-packages\GUI\ButtonBases.py", line 24, in
key_up GControl.key_down(self, event)
NameError: global name 'GControl' is not defined


---------------------------------


from GUI import Application, Window, Label, Button, TextField, Task, Grid,
Alerts


class MyApp(Application):
   def __init__(self):
     Application.__init__(self, title="MyApp")
     self.make_window()


   def make_window(self):
     self.win = Window(size = (400, 400))
     self.add_widgets(self.win)
     self.win.show()


   def add_widgets(self, w):
     self.label1 = Label("Type some text:")
     self.TField1 = TextField()
     self.label2 = Label("Press to exit ->")
     self.quit_button = Button("Quit", action = "do_quit", enabled = False)
     self.grid = Grid([[self.label1,
self.TField1],[self.label2,self.quit_button]], row_spacing=5,
column_spacing=5, align="c", padding=(5,5))
     w.add(self.grid)
     self.timer = Task(self.enable_quit_button, 2)


   def enable_quit_button(self):
     self.quit_button.enabled = True


   def do_quit(self):
     if Alerts.confirm("Exit now?") == 1:
       self.win.destroy()


if __name__ == '__main__':
   MyApp().run()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pygui/attachments/20150117/58f56188/attachment.html>

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppygui @
categoriespython
postedJan 17, '15 at 1:17a
activeJan 17, '15 at 2:48a
posts2
users1
websitecosc.canterbury.ac.nz...

1 user in discussion

James Parkinson: 2 posts

People

Translate

site design / logo © 2019 Grokbase