changeset 58:a4d000f759b4

new event handling utils
author drewp
date Tue, 09 Jul 2002 07:35:57 +0000
parents eaf60f5dce86
children 001646cd5349
files light8/uihelpers.py
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/light8/uihelpers.py	Tue Jul 09 06:34:29 2002 +0000
+++ b/light8/uihelpers.py	Tue Jul 09 07:35:57 2002 +0000
@@ -32,7 +32,28 @@
 # for lambda callbacks    
 def printout(t):
     print t
+
+def printevent(ev):
+    for k in dir(ev):
+        if not k.startswith('__'):
+            print k,getattr(ev,k)
+    print ""
     
+def eventtoparent(ev,sequence):
+    "passes an event to the parent"
+    evdict={}
+    for x in ['state', 'time', 'y', 'x', 'serial']:
+        evdict[x]=getattr(ev,x)
+#    evdict['button']=ev.num
+    par=ev.widget.winfo_parent()
+    if par!=".":
+        ev.widget.nametowidget(par).event_generate(sequence,**evdict)
+    #else the event made it all the way to the top, unhandled
+
+def scrollscrolledwindow(widget,amount):
+    print "scroll",widget,amount
+    
+
 def colorlabel(label):
     """color a label based on its own text"""
     txt=label['text'] or "0"