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: tk_setPalette doesn't accept keyword parameters
Type: behavior Stage: resolved
Components: Tkinter Versions: Python 3.2, Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: HJarausch, gpolo, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2012-11-23 17:24 by HJarausch, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tkinter_tk_setPalette.patch serhiy.storchaka, 2012-12-04 12:34 review
Messages (6)
msg176193 - (view) Author: Helmut Jarausch (HJarausch) Date: 2012-11-23 17:24
import tkinter as Tk
root= Tk.Tk()
root.tk_setPalette(background = 'AntiqueWhite1', foreground = 'blue')

but python-3.3:0+ (3.3:27cb1a3d57c8+) gives

Traceback (most recent call last):
  File "Matr_Select.py", line 174, in <module>
    root.tk_setPalette(background = 'AntiqueWhite1', foreground = 'blue')
  File "/usr/lib64/python3.3/tkinter/__init__.py", line 390, in 
tk_setPalette
    + _flatten(args) + _flatten(kw.items()))
TypeError: argument must be sequence

Thanks for looking into it,
Helmut.
msg176195 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-11-23 17:41
There are two ways to fix this issue:

1. Fix tk_setPalette() (just wrap kw.items() with list() or tuple()).
2. Fix C implementation of _flatten() for work with any iterators.
msg176199 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2012-11-23 17:54
If doing list(kw.items()) works, I'm fine with that. If it does not, then ttk._format_optdict(kw) should.
msg176905 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-04 12:34
Yes, doing list(kw.items()) is safe now. Here is a patch.
msg178331 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-27 20:57
If no one objects I will commit this next year.
msg178805 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-01-02 08:53
New changeset 956cfe53a99f by Serhiy Storchaka in branch '3.2':
Issue #16541: tk_setPalette() now works with keyword arguments.
http://hg.python.org/cpython/rev/956cfe53a99f

New changeset 1ac028634b60 by Serhiy Storchaka in branch '3.3':
Issue #16541: tk_setPalette() now works with keyword arguments.
http://hg.python.org/cpython/rev/1ac028634b60

New changeset 589e6175f037 by Serhiy Storchaka in branch 'default':
Issue #16541: tk_setPalette() now works with keyword arguments.
http://hg.python.org/cpython/rev/589e6175f037
History
Date User Action Args
2022-04-11 14:57:38adminsetgithub: 60745
2013-01-02 09:03:51serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2013-01-02 08:53:02python-devsetnosy: + python-dev
messages: + msg178805
2012-12-27 20:57:03serhiy.storchakasetassignee: serhiy.storchaka
messages: + msg178331
2012-12-04 12:34:06serhiy.storchakasetfiles: + tkinter_tk_setPalette.patch
keywords: + patch
messages: + msg176905

stage: needs patch -> patch review
2012-11-23 17:54:13gpolosetmessages: + msg176199
2012-11-23 17:41:22serhiy.storchakasetversions: + Python 3.2, Python 3.4
nosy: + gpolo, serhiy.storchaka

messages: + msg176195

type: compile error -> behavior
stage: needs patch
2012-11-23 17:24:51HJarauschcreate