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.
Created on 2015年04月16日 22:49 by jmorgensen, last changed 2022年04月11日 14:58 by admin.
| Messages (3) | |||
|---|---|---|---|
| msg241286 - (view) | Author: (jmorgensen) | Date: 2015年04月16日 22:49 | |
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"
|
|||
| msg241370 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2015年04月17日 21:57 | |
Reproduced on Win7, 3.4.3, with updated import: "from tkinter import ttk". The example should serve as a test. |
|||
| msg248149 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2015年08月06日 21:25 | |
This looks like it should be an easy for for someone who understands tcl.call syntax. When we add ttk to Idle, I do not expect to use element_create, but maybe someone will want to to create a custom theme. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:15 | admin | set | github: 68166 |
| 2015年08月06日 21:25:09 | terry.reedy | set | nosy:
+ markroseman, - gpolo messages: + msg248149 versions: + Python 3.6 |
| 2015年04月17日 22:48:20 | serhiy.storchaka | set | assignee: serhiy.storchaka |
| 2015年04月17日 21:57:39 | terry.reedy | set | versions:
+ Python 3.4, Python 3.5 nosy: + terry.reedy messages: + msg241370 type: behavior stage: needs patch |
| 2015年04月16日 22:56:43 | ned.deily | set | nosy:
+ gpolo, serhiy.storchaka type: crash -> (no value) |
| 2015年04月16日 22:49:38 | jmorgensen | create | |