Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8961847

Browse files
committed
Modeless dialog test
1 parent 423c798 commit 8961847

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

Mac/Lib/test/tdlg_modeless.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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.
5+
# This is the modeless version of this test program, the normal
6+
# modal version is in tdlg.py
7+
8+
import addpack
9+
addpack.addpack(':Tools:bgen:evt')
10+
11+
from Dlg import *
12+
from Evt import *
13+
from Events import *
14+
import MacOS
15+
import string
16+
17+
ID = 256
18+
19+
def message(str = "Hello, modeless world!", id = ID):
20+
print 'This is to init the console window...'
21+
d = GetNewDialog(id, -1)
22+
tp, h, rect = d.GetDialogItem(2)
23+
SetDialogItemText(h, str)
24+
while 1:
25+
ok, ev = WaitNextEvent(0xffff, 10)
26+
if not ok:
27+
continue
28+
if IsDialogEvent(ev):
29+
ok, window, item = DialogSelect(ev)
30+
if ok:
31+
if window == d:
32+
if item == 1:
33+
break
34+
else:
35+
print 'Unexpected item hit'
36+
else:
37+
print 'Unexpected dialog hit'
38+
else:
39+
MacOS.HandleEvent(ev)
40+
41+
def test():
42+
message()
43+
44+
if __name__ == '__main__':
45+
test()

0 commit comments

Comments
 (0)