This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Tkinter is not working on trunk (2.6)
Type: Stage:
Components: Tkinter Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: kbk Nosy List: georg.brandl, kbk, ocean-city
Priority: high Keywords:

Created on 2007-06-09 04:35 by ocean-city, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg32289 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2007-06-09 04:35
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?
msg32290 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-06-09 07:40
Neal, you did that change...
msg32291 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2007-07-05 22:07
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.
History
Date User Action Args
2022-04-11 14:56:24adminsetgithub: 45069
2007-06-09 04:35:42ocean-citycreate