diff options
author | Guido van Rossum <guido@python.org> | 1995-02-21 20:56:21 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-02-21 20:56:21 (GMT) |
commit | 0437e890414cd6b34e7ab74d03ba3eab90e29bcb (patch) | |
tree | c761cb2b9298e77071e27955bc27dd7f647e3eb1 /Mac/Lib/test | |
parent | f74c36c9dc959f228656f36094b2bf3969f9b6c1 (diff) | |
download | cpython-0437e890414cd6b34e7ab74d03ba3eab90e29bcb.zip cpython-0437e890414cd6b34e7ab74d03ba3eab90e29bcb.tar.gz cpython-0437e890414cd6b34e7ab74d03ba3eab90e29bcb.tar.bz2 |
fix bug in filterproc interface
Diffstat (limited to 'Mac/Lib/test')
-rw-r--r-- | Mac/Lib/test/tdlg.py | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/Mac/Lib/test/tdlg.py b/Mac/Lib/test/tdlg.py index f234a70..d6fdd97 100644 --- a/Mac/Lib/test/tdlg.py +++ b/Mac/Lib/test/tdlg.py @@ -1,15 +1,30 @@ -# This program requires that a DLOG resource with ID=128 exists. -# You can make one with ResEdit if necessary. +# Function to display a message and wait for the user to hit OK. +# This uses a DLOG resource with ID=256 which is part of the standard +# Python library. +# The ID can be overridden by passing a second parameter. -from Res import * from Dlg import * +from Events import * +import string -ires = 128 +ID = 256 -def filter(*args): print 'filter:', args +def f(d, event): + what, message, when, where, modifiers = event + if what == keyDown and modifiers & cmdKey and \ + string.lower(chr(message & charCodeMask)) == 'o': + return 1 -d = GetNewDialog(ires, -1) -while 1: - n = ModalDialog(filter) - print 'item:', n - if n == 1: break +def message(str = "Hello, world!", id = ID): + d = GetNewDialog(id, -1) + tp, h, rect = d.GetDItem(2) + SetIText(h, str) + while 1: + n = ModalDialog(f) + if n == 1: break + +def test(): + message() + +if __name__ == '__main__': + test() |