File: tdlg.py

package info (click to toggle)
python2.1 2.1.3dfsg-1sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 38,028 kB
  • ctags: 64,228
  • sloc: python: 186,023; ansic: 184,754; xml: 43,435; sh: 12,381; makefile: 3,523; perl: 3,108; lisp: 2,460; cpp: 106; sed: 2
file content (30 lines) | stat: -rw-r--r-- 697 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 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 Dlg import *
from Events import *
import string

ID = 256

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

def message(str = "Hello, world!", id = ID):
	d = GetNewDialog(id, -1)
	tp, h, rect = d.GetDialogItem(2)
	SetDialogItemText(h, str)
	while 1:
		n = ModalDialog(f)
		if n == 1: break

def test():
	message()

if __name__ == '__main__':
	test()