diff options
Diffstat (limited to 'Mac/IDE scripts')
-rw-r--r-- | Mac/IDE scripts/Widget demos/ActivateWindowDemo.py | 26 | ||||
-rw-r--r-- | Mac/IDE scripts/Widget demos/KeyTester.py | 6 | ||||
-rw-r--r-- | Mac/IDE scripts/Widget demos/ListWindow.py | 8 | ||||
-rw-r--r-- | Mac/IDE scripts/Widget demos/TwoLists.py | 8 | ||||
-rw-r--r-- | Mac/IDE scripts/Widget demos/WidgetTest.py | 48 |
5 files changed, 48 insertions, 48 deletions
diff --git a/Mac/IDE scripts/Widget demos/ActivateWindowDemo.py b/Mac/IDE scripts/Widget demos/ActivateWindowDemo.py index 3cd832b..d8fc946 100644 --- a/Mac/IDE scripts/Widget demos/ActivateWindowDemo.py +++ b/Mac/IDE scripts/Widget demos/ActivateWindowDemo.py @@ -4,18 +4,18 @@ import W # evb 22 4 99 class ActivateDemo: - - def __init__(self): - self.w = W.Window((200, 200), 'Activate demo') - self.w.bind("<activate>", self.my_activate_callback) - self.w.open() - - def my_activate_callback(self, onoff): - '''the callback gets 1 parameter which indicates whether the window - has been activated (1) or clicked to the back (0)''' - if onoff == 1: - print "I'm in the front now!" - else: - print "I've been clicked away, Oh No!" + + def __init__(self): + self.w = W.Window((200, 200), 'Activate demo') + self.w.bind("<activate>", self.my_activate_callback) + self.w.open() + + def my_activate_callback(self, onoff): + '''the callback gets 1 parameter which indicates whether the window + has been activated (1) or clicked to the back (0)''' + if onoff == 1: + print "I'm in the front now!" + else: + print "I've been clicked away, Oh No!" ad = ActivateDemo() diff --git a/Mac/IDE scripts/Widget demos/KeyTester.py b/Mac/IDE scripts/Widget demos/KeyTester.py index a9f3140..ae47550 100644 --- a/Mac/IDE scripts/Widget demos/KeyTester.py +++ b/Mac/IDE scripts/Widget demos/KeyTester.py @@ -4,12 +4,12 @@ import W # key callback function def tester(char, event): - text = "%r\r%d\r%s\r%s" % (char, ord(char), hex(ord(chart)), oct(ord(char))) - window.keys.set(text) + text = "%r\r%d\r%s\r%s" % (char, ord(char), hex(ord(chart)), oct(ord(char))) + window.keys.set(text) # close callback def close(): - window.close() + window.close() # new window window = W.Dialog((180, 100), "Type a character") diff --git a/Mac/IDE scripts/Widget demos/ListWindow.py b/Mac/IDE scripts/Widget demos/ListWindow.py index ef066b9..f78b4b8 100644 --- a/Mac/IDE scripts/Widget demos/ListWindow.py +++ b/Mac/IDE scripts/Widget demos/ListWindow.py @@ -1,10 +1,10 @@ import W def listhit(isdbl): - if isdbl: - print "double-click in list!" - else: - print "click in list." + if isdbl: + print "double-click in list!" + else: + print "click in list." window = W.Window((200, 400), "Window with List", minsize = (150, 200)) diff --git a/Mac/IDE scripts/Widget demos/TwoLists.py b/Mac/IDE scripts/Widget demos/TwoLists.py index ee52c89..f1b58f2 100644 --- a/Mac/IDE scripts/Widget demos/TwoLists.py +++ b/Mac/IDE scripts/Widget demos/TwoLists.py @@ -1,16 +1,16 @@ import W def twothird(width, height): - return (8, 8, width - 8, 2*height/3 - 4) + return (8, 8, width - 8, 2*height/3 - 4) def onethird(width, height): - return (8, 2*height/3 + 4, width - 8, height - 22) + return (8, 2*height/3 + 4, width - 8, height - 22) def halfbounds1(width, height): - return (0, 0, width/2 - 4, height) + return (0, 0, width/2 - 4, height) def halfbounds2(width, height): - return (width/2 + 4, 0, width, height) + return (width/2 + 4, 0, width, height) window = W.Window((400, 400), "Sizable window with two lists", minsize = (200, 200)) diff --git a/Mac/IDE scripts/Widget demos/WidgetTest.py b/Mac/IDE scripts/Widget demos/WidgetTest.py index 424e70d..a2e8d08 100644 --- a/Mac/IDE scripts/Widget demos/WidgetTest.py +++ b/Mac/IDE scripts/Widget demos/WidgetTest.py @@ -2,34 +2,34 @@ import W # define some callbacks def callback(): - window.close() + window.close() def checkcallback(value): - print "hit the checkbox", value + print "hit the checkbox", value def radiocallback(value): - print "hit radiobutton #3", value + print "hit radiobutton #3", value def scrollcallback(value): - widget = window.hbar - if value == "+": - widget.set(widget.get() - 1) - elif value == "-": - widget.set(widget.get() + 1) - elif value == "++": - widget.set(widget.get() - 10) - elif value == "--": - widget.set(widget.get() + 10) - else: # in thumb - widget.set(value) - print "scroll...", widget.get() + widget = window.hbar + if value == "+": + widget.set(widget.get() - 1) + elif value == "-": + widget.set(widget.get() + 1) + elif value == "++": + widget.set(widget.get() - 10) + elif value == "--": + widget.set(widget.get() + 10) + else: # in thumb + widget.set(value) + print "scroll...", widget.get() def textcallback(): - window.et3.set(window.et1.get()) + window.et3.set(window.et1.get()) def cancel(): - import EasyDialogs - EasyDialogs.Message("Cancel!") + import EasyDialogs + EasyDialogs.Message("Cancel!") # make a non-sizable window #window = W.Window((200, 300), "Fixed Size") @@ -77,9 +77,9 @@ window.setdefaultbutton(window.button) window.open() if 0: - import time - for i in range(20): - window.et2.set(repr(i)) - #window.et2.SetPort() - #window.et2.draw() - time.sleep(0.1) + import time + for i in range(20): + window.et2.set(repr(i)) + #window.et2.SetPort() + #window.et2.draw() + time.sleep(0.1) |