[Python-checkins] r62937 - sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py

guilherme.polo python-checkins at python.org
Fri May 9 15:19:38 CEST 2008


Author: guilherme.polo
Date: Fri May  9 15:19:38 2008
New Revision: 62937

Log:
Added identify method to Widget and Notebook, which are not documented yet but exists in the tk source, works with a tcl interpreter, and Pat Thoyts told me that all ttk widgets have a identify command.

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	Fri May  9 15:19:38 2008
@@ -427,6 +427,15 @@
         """
         Tkinter.Widget.__init__(self, master, widgetname, cnf, kw, extra)
 
+    
+    # XXX identify is not documented in ttk::widget, but it is defined in tk
+    #     source and it works for all widgets. Other widgets may provide their 
+    #     own, and possibly different, identify method.
+    def identify(self, x, y):
+        """Returns the name of the element at position x, y, or the empty 
+        string if the coordinates are outside the window."""
+        return self.tk.call(self._w, "identify", x, y)
+
 
     def instate(self, statespec, callback=None, *args):
         """Test the widget's state. 
@@ -714,6 +723,12 @@
         self.tk.call(self._w, "hide", tab_id)
 
 
+    def identify(self, x, y):
+        """Returns the name of the tab element at position x, y, or the 
+        empty string if none."""
+        return self.tk.call(self._w, "identify", x, y)
+
+
     def index(self, tab_id):
         """Returns the numeric index of the tab specified by tab_id, or
         the total number of tabs if tab_id is the string "end"."""
@@ -753,7 +768,7 @@
         return self.tk.call(self._w, "tabs")
 
 
-    def enableTraversal(self):
+    def enable_traversal(self):
         """Enable keyboard traversal for a toplevel window containing
         this notebook.
 


More information about the Python-checkins mailing list