1995-02-21 20:56:21 +00:00
|
|
|
# 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.
|
1995-01-30 11:53:55 +00:00
|
|
|
|
1995-06-06 12:55:40 +00:00
|
|
|
import addpack
|
|
|
|
addpack.addpack(':Tools:bgen:evt')
|
|
|
|
|
1995-01-30 11:53:55 +00:00
|
|
|
from Dlg import *
|
1995-02-21 20:56:21 +00:00
|
|
|
from Events import *
|
|
|
|
import string
|
1995-01-30 11:53:55 +00:00
|
|
|
|
1995-02-21 20:56:21 +00:00
|
|
|
ID = 256
|
1995-01-30 11:53:55 +00:00
|
|
|
|
1995-02-21 20:56:21 +00:00
|
|
|
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
|
1995-01-30 11:53:55 +00:00
|
|
|
|
1995-02-21 20:56:21 +00:00
|
|
|
def message(str = "Hello, world!", id = ID):
|
|
|
|
d = GetNewDialog(id, -1)
|
1995-06-06 12:55:40 +00:00
|
|
|
tp, h, rect = d.GetDialogItem(2)
|
|
|
|
SetDialogItemText(h, str)
|
1995-02-21 20:56:21 +00:00
|
|
|
while 1:
|
|
|
|
n = ModalDialog(f)
|
|
|
|
if n == 1: break
|
|
|
|
|
|
|
|
def test():
|
|
|
|
message()
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
test()
|