[New-bugs-announce] [issue23978] ttk.Style.element_create using incorrect tk.call syntax
jmorgensen
report at bugs.python.org
Fri Apr 17 00:49:38 CEST 2015
New submission from jmorgensen:
Style.element_create passes all spec elements as a single string into tk.call rather than breaking up arguments into "words." However, it passes the options properly as a list.
This causes python to crash with a stacktrace like the one below.
> def element_create(self, elementname, etype, *args, **kw):
> """Create a new element in the current theme of given etype."""
> spec, opts = _format_elemcreate(etype, False, *args, **kw)
> self.tk.call(self._name, "element", "create", elementname, etype,
> spec, *opts)
And in _format_elemcreate:
> spec = "%s %s" % (iname, imagespec)
> ...
> spec = "%s %s %s" % (class_name, part_id, statemap)
Reproduction (on win):
> >>> import ttk
> >>> Style().element_create('custom.test', 'vsapi', 'SPIN', 2)
> File "<stdin>", line 1, in <module>
> File "C:\Miniconda\lib\lib-tk\ttk.py", line 466, in element_create
> spec, *opts)
> _tkinter.TclError: missing required arguments 'class' and/or 'partId'
and, similarly:
> >>> import ttk
> >>> ttk.Style().element_create('custom.test', 'vsapi', 'SPIN', 2, width=5)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "C:\Miniconda\lib\lib-tk\ttk.py", line 466, in element_create
> spec, *opts)
> _tkinter.TclError: expected integer but got "-width"
----------
components: Tkinter
messages: 241286
nosy: jmorgensen
priority: normal
severity: normal
status: open
title: ttk.Style.element_create using incorrect tk.call syntax
type: crash
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23978>
_______________________________________
More information about the New-bugs-announce
mailing list