[Python-bugs-list] Re: Tkinter wm_colormapwindows doesn't work w/o breaking Tkinter encapsulation (PR#107)
guido@CNRI.Reston.VA.US
guido@CNRI.Reston.VA.US
Tue, 19 Oct 1999 09:12:45 -0400 (EDT)
> From first glance, it appears there may be two problems:
>
> 1) the Tkinter objects aren't being translated to Tk widget names
> (label._w, frame._w), and
This is actually not a bug -- when you print a tuple, repr() is applied
to its items, but the tk.call() method applies str() to the arguments,
and the str() of a Tkinter widget returns its _w attribute. Try
printing map(str, ...) over the final argument tuple.
> 2) The window list isn't being passed to Tk as a Tk list
> (i.e. one arg to tk.call)
That's the bug. I can't really test it right now, but does the
following fix it?
***************
*** 783,789 ****
return self.tk.call('wm', 'client', self._w, name)
client = wm_client
def wm_colormapwindows(self, *wlist):
! args = ('wm', 'colormapwindows', self._w) + _flatten(wlist)
return map(self._nametowidget, self.tk.call(args))
colormapwindows = wm_colormapwindows
def wm_command(self, value=None):
--- 783,791 ----
return self.tk.call('wm', 'client', self._w, name)
client = wm_client
def wm_colormapwindows(self, *wlist):
! if wlist:
! wlist = (wlist,) # Tk needs a list of windows here
! args = ('wm', 'colormapwindows', self._w) + wlist
return map(self._nametowidget, self.tk.call(args))
colormapwindows = wm_colormapwindows
def wm_command(self, value=None):
--Guido van Rossum (home page: http://www.python.org/~guido/)