The 0.5 release happened on 2/15, not on 2/14. :-)
[python/dscho.git] / Mac / Lib / test / tdlg.py
blob6bb051b924851bc50d1b73445d4db558890b30d6
1 # Function to display a message and wait for the user to hit OK.
2 # This uses a DLOG resource with ID=256 which is part of the standard
3 # Python library.
4 # The ID can be overridden by passing a second parameter.
6 from Dlg import *
7 from Events import *
8 import string
10 ID = 256
12 def f(d, event):
13 what, message, when, where, modifiers = event
14 if what == keyDown and modifiers & cmdKey and \
15 string.lower(chr(message & charCodeMask)) == 'o':
16 return 1
18 def message(str = "Hello, world!", id = ID):
19 d = GetNewDialog(id, -1)
20 tp, h, rect = d.GetDialogItem(2)
21 SetDialogItemText(h, str)
22 while 1:
23 n = ModalDialog(f)
24 if n == 1: break
26 def test():
27 message()
29 if __name__ == '__main__':
30 test()