diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1995-08-31 13:42:35 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1995-08-31 13:42:35 (GMT) |
commit | 8961847e1850790c0b0616c9676a40e26df3d418 (patch) | |
tree | 317438129c851238c9a78e7ca687ef0dcfb30ff9 /Mac | |
parent | 423c798b3c769c901e8a342a5a85e4612277912a (diff) | |
download | cpython-8961847e1850790c0b0616c9676a40e26df3d418.zip cpython-8961847e1850790c0b0616c9676a40e26df3d418.tar.gz cpython-8961847e1850790c0b0616c9676a40e26df3d418.tar.bz2 |
Modeless dialog test
Diffstat (limited to 'Mac')
-rw-r--r-- | Mac/Lib/test/tdlg_modeless.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Mac/Lib/test/tdlg_modeless.py b/Mac/Lib/test/tdlg_modeless.py new file mode 100644 index 0000000..8d79dd7 --- /dev/null +++ b/Mac/Lib/test/tdlg_modeless.py @@ -0,0 +1,45 @@ +# 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. +# This is the modeless version of this test program, the normal +# modal version is in tdlg.py + +import addpack +addpack.addpack(':Tools:bgen:evt') + +from Dlg import * +from Evt import * +from Events import * +import MacOS +import string + +ID = 256 + +def message(str = "Hello, modeless world!", id = ID): + print 'This is to init the console window...' + d = GetNewDialog(id, -1) + tp, h, rect = d.GetDialogItem(2) + SetDialogItemText(h, str) + while 1: + ok, ev = WaitNextEvent(0xffff, 10) + if not ok: + continue + if IsDialogEvent(ev): + ok, window, item = DialogSelect(ev) + if ok: + if window == d: + if item == 1: + break + else: + print 'Unexpected item hit' + else: + print 'Unexpected dialog hit' + else: + MacOS.HandleEvent(ev) + +def test(): + message() + +if __name__ == '__main__': + test() |