[ python-Bugs-1733943 ] Tkinter is not working on trunk (2.6)

SourceForge.net noreply at sourceforge.net
Fri Jul 6 00:07:47 CEST 2007


Bugs item #1733943, was opened at 2007-06-09 00:35
Message generated for change (Comment added) made by kbk
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1733943&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tkinter
Group: Python 2.6
>Status: Closed
>Resolution: Fixed
>Priority: 6
Private: No
Submitted By: Hirokazu Yamamoto (ocean-city)
>Assigned to: Kurt B. Kaiser (kbk)
Summary: Tkinter is not working on trunk (2.6)

Initial Comment:
Hello. I tried to run tk app on trunk, I got following error.

///////////////////////////////////
// Code

import Tkinter as Tk
root = Tk.Tk()
label = Tk.Label(root, text="Test")
label.pack(fill=Tk.BOTH, expand=True)
root.mainloop()

///////////////////////////////////
// Error

Traceback (most recent call last):
  File "\debug.py", line 6, in <module>
    label = Tk.Label(root, text="Test")
  File "e:\python-dev\trunk\lib\lib-tk\Tkinter.py", line 2464, in __init__
    Widget.__init__(self, master, 'label', cnf, kw)
  File "e:\python-dev\trunk\lib\lib-tk\Tkinter.py", line 1930, in __init__
    (widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: invalid command name "label .12893496 -text Test"


This is due to the change revision 55504 (Stop using METH_OLDARGS)

Currently, lib/lib-tk/Tkinter.py uses this convension

1929:        self.tk.call(
1930:            (widgetName, self._w) + extra + self._options(cnf))

...passing argument as single tuple. METH_OLDARGS treats this as same as 

        self.tk.call(
            widgetName, self._w, *(extra + self._options(cnf)))

So it was working, but now METH_VARARGS, it doesn't expand single tuple as arguments.

Maybe do we need to check all tk.call and apply patches like this?

Index: Lib/lib-tk/Tkinter.py
===================================================================
--- Lib/lib-tk/Tkinter.py	(revision 55836)
+++ Lib/lib-tk/Tkinter.py	(working copy)
@@ -1927,7 +1927,7 @@
                 classes.append((k, cnf[k]))
                 del cnf[k]
         self.tk.call(
-            (widgetName, self._w) + extra + self._options(cnf))
+            widgetName, self._w, *(extra + self._options(cnf)))
         for k, v in classes:
             k.configure(self, v)
     def destroy(self):

# Maybe already someone working on this?


----------------------------------------------------------------------

>Comment By: Kurt B. Kaiser (kbk)
Date: 2007-07-05 18:07

Message:
Logged In: YES 
user_id=149084
Originator: NO

Fixed at rev 56176.  Ref Patch 1496952.

Issue was arglists containing a single tuple which were unpacked
differently using the METH_OLDARG flag compared to the METH_VARARGS flag
now used.

----------------------------------------------------------------------

Comment By: Georg Brandl (gbrandl)
Date: 2007-06-09 03:40

Message:
Logged In: YES 
user_id=849994
Originator: NO

Neal, you did that change...

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1733943&group_id=5470


More information about the Python-bugs-list mailing list