summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-12-12 16:43:05 (GMT)
committerGuido van Rossum <guido@python.org>1996-12-12 16:43:05 (GMT)
commitc0967cd4a2e51054c12c8c8208bb4431e57d6fb3 (patch)
treeddc104365c2c72a3cda233446accf791590d56b3
parente4ac0aa6183f06b9908f013ee22da56dfb16f373 (diff)
downloadcpython-c0967cd4a2e51054c12c8c8208bb4431e57d6fb3.zip
cpython-c0967cd4a2e51054c12c8c8208bb4431e57d6fb3.tar.gz
cpython-c0967cd4a2e51054c12c8c8208bb4431e57d6fb3.tar.bz2
Added a bunch of new winfo options; we should now be up to date with
Tk 4.2. The new winfo options supported are: mananger, pointerx, pointerxy, pointery, server, viewable, visualid, visualsavailable. Also fixed bugs in winfo_colormapfull() and winfo_containing().
-rw-r--r--Lib/lib-tk/Tkinter.py31
-rwxr-xr-xLib/tkinter/Tkinter.py31
2 files changed, 58 insertions, 4 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index c482f46..916b3c8 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -297,11 +297,13 @@ class Misc:
return self.tk.call('winfo', 'class', self._w)
def winfo_colormapfull(self):
return self.tk.getboolean(
- self.tk.call('winfo', 'colormapfull'))
+ self.tk.call('winfo', 'colormapfull', self._w))
def winfo_containing(self, rootX, rootY, displayof=0):
args = ('winfo', 'containing') \
+ self._displayof(displayof) + (rootX, rootY)
- return self._nametowidget(apply(self.tk.call, args))
+ name = apply(self.tk.call, args)
+ if not name: return None
+ return self._nametowidget(name)
def winfo_depth(self):
return self.tk.getint(self.tk.call('winfo', 'depth', self._w))
def winfo_exists(self):
@@ -324,6 +326,8 @@ class Misc:
def winfo_ismapped(self):
return self.tk.getint(
self.tk.call('winfo', 'ismapped', self._w))
+ def winfo_manager(self):
+ return self.tk.call('winfo', 'manager', self._w)
def winfo_name(self):
return self.tk.call('winfo', 'name', self._w)
def winfo_parent(self):
@@ -335,6 +339,15 @@ class Misc:
def winfo_pixels(self, number):
return self.tk.getint(
self.tk.call('winfo', 'pixels', self._w, number))
+ def winfo_pointerx(self):
+ return self.tk.getint(
+ self.tk.call('winfo', 'pointerx', self._w))
+ def winfo_pointerxy(self):
+ return self._getints(
+ self.tk.call('winfo', 'pointerxy', self._w))
+ def winfo_pointery(self):
+ return self.tk.getint(
+ self.tk.call('winfo', 'pointery', self._w))
def winfo_reqheight(self):
return self.tk.getint(
self.tk.call('winfo', 'reqheight', self._w))
@@ -372,11 +385,25 @@ class Misc:
def winfo_screenwidth(self):
return self.tk.getint(
self.tk.call('winfo', 'screenwidth', self._w))
+ def winfo_server(self):
+ return self.tk.call('winfo', 'server', self._w)
def winfo_toplevel(self):
return self._nametowidget(self.tk.call(
'winfo', 'toplevel', self._w))
+ def winfo_viewable(self):
+ return self.tk.getint(
+ self.tk.call('winfo', 'viewable', self._w))
def winfo_visual(self):
return self.tk.call('winfo', 'visual', self._w)
+ def winfo_visualid(self):
+ return self.tk.call('winfo', 'visualid', self._w)
+ def winfo_visualsavailable(self, includeids=0):
+ data = self.tk.split(
+ self.tk.call('winfo', 'visualsavailable', self._w,
+ includeids and 'includeids' or None))
+ def parseitem(x, self=self):
+ return x[:1] + tuple(map(self.tk.getint, x[1:]))
+ return map(parseitem, data)
def winfo_vrootheight(self):
return self.tk.getint(
self.tk.call('winfo', 'vrootheight', self._w))
diff --git a/Lib/tkinter/Tkinter.py b/Lib/tkinter/Tkinter.py
index c482f46..916b3c8 100755
--- a/Lib/tkinter/Tkinter.py
+++ b/Lib/tkinter/Tkinter.py
@@ -297,11 +297,13 @@ class Misc:
return self.tk.call('winfo', 'class', self._w)
def winfo_colormapfull(self):
return self.tk.getboolean(
- self.tk.call('winfo', 'colormapfull'))
+ self.tk.call('winfo', 'colormapfull', self._w))
def winfo_containing(self, rootX, rootY, displayof=0):
args = ('winfo', 'containing') \
+ self._displayof(displayof) + (rootX, rootY)
- return self._nametowidget(apply(self.tk.call, args))
+ name = apply(self.tk.call, args)
+ if not name: return None
+ return self._nametowidget(name)
def winfo_depth(self):
return self.tk.getint(self.tk.call('winfo', 'depth', self._w))
def winfo_exists(self):
@@ -324,6 +326,8 @@ class Misc:
def winfo_ismapped(self):
return self.tk.getint(
self.tk.call('winfo', 'ismapped', self._w))
+ def winfo_manager(self):
+ return self.tk.call('winfo', 'manager', self._w)
def winfo_name(self):
return self.tk.call('winfo', 'name', self._w)
def winfo_parent(self):
@@ -335,6 +339,15 @@ class Misc:
def winfo_pixels(self, number):
return self.tk.getint(
self.tk.call('winfo', 'pixels', self._w, number))
+ def winfo_pointerx(self):
+ return self.tk.getint(
+ self.tk.call('winfo', 'pointerx', self._w))
+ def winfo_pointerxy(self):
+ return self._getints(
+ self.tk.call('winfo', 'pointerxy', self._w))
+ def winfo_pointery(self):
+ return self.tk.getint(
+ self.tk.call('winfo', 'pointery', self._w))
def winfo_reqheight(self):
return self.tk.getint(
self.tk.call('winfo', 'reqheight', self._w))
@@ -372,11 +385,25 @@ class Misc:
def winfo_screenwidth(self):
return self.tk.getint(
self.tk.call('winfo', 'screenwidth', self._w))
+ def winfo_server(self):
+ return self.tk.call('winfo', 'server', self._w)
def winfo_toplevel(self):
return self._nametowidget(self.tk.call(
'winfo', 'toplevel', self._w))
+ def winfo_viewable(self):
+ return self.tk.getint(
+ self.tk.call('winfo', 'viewable', self._w))
def winfo_visual(self):
return self.tk.call('winfo', 'visual', self._w)
+ def winfo_visualid(self):
+ return self.tk.call('winfo', 'visualid', self._w)
+ def winfo_visualsavailable(self, includeids=0):
+ data = self.tk.split(
+ self.tk.call('winfo', 'visualsavailable', self._w,
+ includeids and 'includeids' or None))
+ def parseitem(x, self=self):
+ return x[:1] + tuple(map(self.tk.getint, x[1:]))
+ return map(parseitem, data)
def winfo_vrootheight(self):
return self.tk.getint(
self.tk.call('winfo', 'vrootheight', self._w))