These patches may be useful to other users of pybwidget
--- Begin Message ---
I've been attempting to use your Python wrapper to
BWidget and encountered a few issues.  I've attached a
diff of the __init__.py and setup.py files that fix a
number of issues.  Unfortunately, the Tree widget for
which I originally looked BWidget for appears to be
inadequate for my task at hand so I'm moving onto
another tree implementation.  

Your Python wrapper is a good start but, as with
anything new, there some issues that still need
resolution.  I've fixed some of the binding code to
properly create Tcl procedures that wire into the
passed Python functions.  However, there may be
remaining problems.  

I may continue to use other aspects of the BWidget and
thus will report any other problems I find and/or fix.

I've also attached a ChangeLog that outlines the
changes I made.

Regards,
Arthur
--- pybwidget-0.1.1_1.7.0/bwidget/__init__.py   2004-11-28 14:46:21.000000000 
-0500
+++ pybwidget-0.1.1_1.7.0-mod/bwidget/__init__.py       2004-12-23 
16:07:07.000000000 -0500
@@ -52,6 +52,8 @@
 
 import Tkinter, types, os, sys, new
 
+ROOT='root'
+
 def _wrap(wrapper, oldfunc):
     return new.function(wrapper.func_code, wrapper.func_globals,
             oldfunc.func_name, wrapper.func_defaults, wrapper.func_closure)
@@ -265,8 +267,12 @@
         return self.tk.call(self._w, "raise", page)
 
 class NoteBook(BWidget, Tkinter.Frame, _Items):
-    def bindtabs(self, event, script):
-        return self.tk.call(self._w, "bindtabs", event, script)
+    def bindtabs(self, event, func):
+        if callable(func):
+            command = self.register( func )
+        else:
+            command = func
+        return self.tk.call(self._w, "bindtabs", event, command)
 
     def delete(self, page, destroyframe=True):
         return self.tk.call(self._w, "delete", page, destroyframe)
@@ -355,11 +361,21 @@
         return self.tk.call(self._w, "getvalue")
 
 class Tree(BWidget, Tkinter.Widget, _Items):
-    def bind_image(self, event, script):
-        return self.tk.call(self._w, "bindImage", event, script)
-
-    def bind_text(self, event, script):
-        return self.tk.call(self._w, "bindText", event, script)
+    def bind_image(self, event, func):
+        if callable(func):
+            command = self.register( func )
+        else:
+            command = func
+        return self.tk.call(self._w, "bindImage", event, command)
+    bindImage = bind_image
+
+    def bind_text(self, event, func):
+        if callable(func):
+            command = self.register( func )
+        else:
+            command = func
+        return self.tk.call(self._w, "bindText", event, command)
+    bindText = bind_text
 
     def closetree(self, node):
         return self.tk.call(self._w, "closetree", node)
@@ -385,7 +401,7 @@
         return self.tk.call(self._w, "move", parent, node, index)
 
     def nodes(self, node, *args):
-        return self.tk.call(self._w, "nodes", *args)
+        return self.tk.call(self._w, "nodes", node, *args)
 
     def opentree(self, node, recurse=True):
         return self.tk.call(self._w, "opentree", node, recurse)
@@ -403,13 +419,13 @@
         return self.tk.call(self._w, "selection", "add", *args)
 
     def selection_clear(self):
-        return self.tl.call(self._w, "selection", "clear")
+        return self.tk.call(self._w, "selection", "clear")
 
     def selection_get(self):
-        return self.tl.call(self._w, "selection", "get")
+        return self.tk.call(self._w, "selection", "get")
 
     def selection_includes(self, node):
-        return self.tl.call(self._w, "selection", "includes")
+        return self.tk.call(self._w, "selection", "includes", node)
 
     def selection_remove(self, *args):
         return self.tk.call(self._w, "selection", "remove", *args)
@@ -433,11 +449,21 @@
         return self.tk.call(self.yview, *args)
 
 class ListBox(BWidget, Tkinter.Widget, _Items):
-    def bind_image(self, event, script):
-        return self.tk.call(self._w, "bindImage", event, script)
-
-    def bind_text(self, event, script):
-        return self.tk.call(self._w, "bindText", event, script)
+    def bind_image(self, event, func):
+        if callable(func):
+            command = self.register( func )
+        else:
+            command = func
+        return self.tk.call(self._w, "bindImage", event, command)
+    bindImage = bind_image
+
+    def bind_text(self, event, func):
+        if callable(func):
+            command = self.register( func )
+        else:
+            command = func
+        return self.tk.call(self._w, "bindText", event, func)
+    bindText = bind_text
 
     def delete(self, arg, *args):
         return self.tk.call(self._w, "delete", arg, *args)
@@ -472,13 +498,13 @@
         return self.tk.call(self._w, "selection", "add", *args)
 
     def selection_clear(self):
-        return self.tl.call(self._w, "selection", "clear")
+        return self.tk.call(self._w, "selection", "clear")
 
     def selection_get(self):
-        return self.tl.call(self._w, "selection", "get")
+        return self.tk.call(self._w, "selection", "get")
 
     def selection_includes(self, node):
-        return self.tl.call(self._w, "selection", "includes")
+        return self.tk.call(self._w, "selection", "includes", node)
 
     def selection_remove(self, *args):
         return self.tk.call(self._w, "selection", "remove", *args)
--- pybwidget-0.1.1_1.7.0/setup.py      2004-11-28 14:48:23.000000000 -0500
+++ pybwidget-0.1.1_1.7.0-mod/setup.py  2004-12-21 11:51:20.000000000 -0500
@@ -18,6 +18,7 @@
           files(".", "*.tcl"),
           files(".", "LICENSE.txt"),
           files("images", "*.gif"),
+          files("images", "*.xbm"),
           files("lang", "*.rc"),
     ],
     url="http://tkinter.unpythonic.net/bwidget";,

Attachment: ChangeLog
Description: ChangeLog


--- End Message ---

Attachment: pgpAeGqozKKs0.pgp
Description: PGP signature

_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to