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.

Author jmorgensen
Recipients jmorgensen
Date 2015-04-16.22:49:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1429224578.03.0.989768410298.issue23978@psf.upfronthosting.co.za>
In-reply-to
Content
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"
History
Date User Action Args
2015-04-16 22:49:38jmorgensensetrecipients: + jmorgensen
2015-04-16 22:49:38jmorgensensetmessageid: <1429224578.03.0.989768410298.issue23978@psf.upfronthosting.co.za>
2015-04-16 22:49:37jmorgensenlinkissue23978 messages
2015-04-16 22:49:37jmorgensencreate