comparison gamelib/misc.py @ 347:35f09e0ccd16

Make 'Esc' cancel the 'Are You Sure?' dialog. Fix dialog title
author Neil Muller <drnlmuller@gmail.com>
date Sat, 05 Sep 2009 23:13:48 +0000
parents 82a18615a0ab
children 2d0ff46118e2
comparison
equal deleted inserted replaced
346:6baf8b5beb5c 347:35f09e0ccd16
51 return item 51 return item
52 roll -= weight 52 roll -= weight
53 53
54 class CheckDialog(gui.Dialog): 54 class CheckDialog(gui.Dialog):
55 def __init__(self, **params): 55 def __init__(self, **params):
56 title = gui.Label('Are You sure') 56 title = gui.Label('Are You Sure?')
57 self.do_quit = False 57 self.do_quit = False
58 self.running = True 58 self.running = True
59 tbl = gui.Table() 59 tbl = gui.Table()
60 tbl.tr() 60 tbl.tr()
61 tbl.td(gui.Label("Do you REALLY want to exit this game?"), colspan=2) 61 tbl.td(gui.Label("Do you REALLY want to exit this game?"), colspan=2)
75 self.running = False 75 self.running = False
76 self.close() 76 self.close()
77 77
78 def event(self, e): 78 def event(self, e):
79 if e.type == KEYDOWN and e.key == K_ESCAPE: 79 if e.type == KEYDOWN and e.key == K_ESCAPE:
80 self.clicked(True) 80 self.clicked(False)
81 return True 81 return True
82 return gui.Dialog.event(self, e) 82 return gui.Dialog.event(self, e)
83 83
84 def check_exit(): 84 def check_exit():
85 dialog = CheckDialog() 85 dialog = CheckDialog()