[Python-checkins] r62789 - sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py
guilherme.polo
python-checkins at python.org
Wed May 7 00:54:52 CEST 2008
Author: guilherme.polo
Date: Wed May 7 00:54:51 2008
New Revision: 62789
Log:
Updated tag_bind and heading Treeview methods, they should be working correctly. _dict_from_tcltuple does a more precise check for StateSpec.
Modified:
sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py
Modified: sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py (original)
+++ sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py Wed May 7 00:54:51 2008
@@ -193,9 +193,9 @@
if value.find(' ') != -1: # could be padding returned by configure
value = map(int, value.split())
- elif hasattr(value, "__len__"):
- # possibly a StateSpec object returned by map
- value = [[str(value[0]).split(), value[1]]]
+ elif hasattr(value, "__len__") and hasattr(value[0], "typename"):
+ if value[0].typename == "StateSpec":
+ value = [[str(value[0]).split(), value[1]]]
opts.append((opt, value))
@@ -1035,9 +1035,9 @@
the standard Tk anchor values
command: script
A script to evaluate when the heading label is pressed.
+ This could be passed using Misc.register(callback).
Pass column as #0 to configure the tree column heading."""
- # XXX change the "command: script" to a callback
return self.tk.call(self._w, "heading", column, *(_format_optdict(kw)))
@@ -1173,15 +1173,14 @@
return self.tk.call(self._w, "set", item, column, value)
- def tag_bind(self, tagName, sequence=None, callback=None, *args):
- """Add a callback for the event sequence to the tag tagName.
-
- When an X event is delivered to an item, the callback for each
+ def tag_bind(self, tagName, sequence=None, script=None):
+ """Bind a script for the event sequence to the tag tagName.
+ script is possibly passed using Misc.register(callback) combined
+ with substitutions.
+
+ When an X event is delivered to an item, the script for each
of the item's tags option are called."""
- # XXX won't work, possibly next commit will have this fixed
- r = self.tk.call(self._w, "tag", "bind", tagName, sequence)
- if r:
- return callback(*args)
+ self.tk.call(self._w, "tag", "bind", tagName, sequence, script)
def tag_configure(self, tagName, **kw):
More information about the Python-checkins
mailing list