[Python-bugs-list] Re: Tkinter wm_colormapwindows doesn't work w/o breaking Tkinter encapsulation (PR#107)
aa8vb@yahoo.com
aa8vb@yahoo.com
Wed, 20 Oct 1999 07:01:45 -0400 (EDT)
Guido van Rossum:
|> 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.
Ok.
|> 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?
I think so. That is, it doesn't generate Tk errors. (I'm still trying to
figure out how to coerce 8-bit colormap focus.)
Thanks,
Randall
|***************
|*** 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/)