comparison light8/uihelpers.py @ 26:219d6fcbc28d

Reclassification, minor cleanups Reclassification, minor cleanups No more global variables in rsn! They are all in a class called LightBoard.
author dmcc
date Sun, 07 Jul 2002 08:33:52 +0000
parents 7adc65771676
children e9d2e7754fd9
comparison
equal deleted inserted replaced
25:f0e1dde35aec 26:219d6fcbc28d
5 def make_frame(parent): 5 def make_frame(parent):
6 f = Frame(parent, bd=0) 6 f = Frame(parent, bd=0)
7 f.pack(side='left') 7 f.pack(side='left')
8 return f 8 return f
9 9
10
11 def bindkeys(root,key, func): 10 def bindkeys(root,key, func):
12 root.bind(key, func) 11 root.bind(key, func)
13 for w in root.winfo_children(): 12 for w in root.winfo_children():
14 w.bind(key, func) 13 w.bind(key, func)
15
16 14
17 def toplevelat(x,y,w=None,h=None): 15 def toplevelat(x,y,w=None,h=None):
18 tl=Toplevel() 16 tl=Toplevel()
19 if w and h: 17 if w and h:
20 tl.wm_geometry("%dx%d+%d+%d"%(w,h,x,y)) 18 tl.wm_geometry("%dx%d+%d+%d"%(w,h,x,y))
21 else: 19 else:
22 tl.wm_geometry("+%d+%d"%(x,y)) 20 tl.wm_geometry("+%d+%d"%(x,y))
23 return tl 21 return tl
24
25 22
26 def toggle_slider(s): 23 def toggle_slider(s):
27 if s.get() == 0: 24 if s.get() == 0:
28 s.set(100) 25 s.set(100)
29 else: 26 else:
31 28
32 # for lambda callbacks 29 # for lambda callbacks
33 def printout(t): 30 def printout(t):
34 print t 31 print t
35 32
36
37 def colorlabel(label): 33 def colorlabel(label):
38 """color a label based on its own text""" 34 """color a label based on its own text"""
39 txt=label['text'] or "0" 35 txt=label['text'] or "0"
40 lev=float(txt)/100 36 lev=float(txt)/100
41 low=(80,80,180) 37 low=(80,80,180)