-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
ttk.Style.element_create using incorrect tk.call syntax #68166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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.
And in _format_elemcreate:
Reproduction (on win):
and, similarly:
|
Reproduced on Win7, 3.4.3, with updated import: "from tkinter import ttk". The example should serve as a test. |
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. |
* Fix and document support of "vsapi" element type in tkinter.ttk.Style.element_create(). * Add tests for element_create() and other ttk.Style methods. * Add examples for element_create() in the documentation.
There are two ways to create new elements in Tkinter. One is by calling the It is also an opportunity to change the Python API (which never worked) to closer match the Tk API. I.e. instead of style.element_create('pin', 'vsapi', 'EXPLORERBAR', 3,
('pressed', '!selected', 3),
('active', '!selected', 2),
('pressed', 'selected', 6),
('active', 'selected', 5),
('selected', 4),
('', 1)) it should be style.element_create('pin', 'vsapi', 'EXPLORERBAR', 3, [
('pressed', '!selected', 3),
('active', '!selected', 2),
('pressed', 'selected', 6),
('active', 'selected', 5),
('selected', 4),
('', 1)]) or style.element_create('pin', 'vsapi', 'EXPLORERBAR', 3, [
(('pressed', '!selected'), 3),
(('active', '!selected'), 2),
(('pressed', 'selected'), 6),
(('active', 'selected'), 5),
(('selected',), 4),
((), 1)]) or style.element_create('pin', 'vsapi', 'EXPLORERBAR', 3, {
('pressed', '!selected'): 3,
('active', '!selected'): 2,
('pressed', 'selected'): 6,
('active', 'selected'): 5,
('selected',): 4,
(): 1}) |
* Remove mention of "vsapi" element type from the documentation. * Add tests for element_create() and other ttk.Style methods. * Add examples for element_create() in the documentation.
…1453) * Remove mention of "vsapi" element type from the documentation. * Add tests for element_create() and other ttk.Style methods. * Add examples for element_create() in the documentation.
…ythonGH-111453) * Remove mention of "vsapi" element type from the documentation. * Add tests for element_create() and other ttk.Style methods. * Add examples for element_create() in the documentation. (cherry picked from commit 005d1e8) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…ythonGH-111453) * Remove mention of "vsapi" element type from the documentation. * Add tests for element_create() and other ttk.Style methods. * Add examples for element_create() in the documentation. (cherry picked from commit 005d1e8) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…GH-111453) (GH-111858) * Remove mention of "vsapi" element type from the documentation. * Add tests for element_create() and other ttk.Style methods. * Add examples for element_create() in the documentation. (cherry picked from commit 005d1e8) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…GH-111453) (GH-111857) * Remove mention of "vsapi" element type from the documentation. * Add tests for element_create() and other ttk.Style methods. * Add examples for element_create() in the documentation. (cherry picked from commit 005d1e8) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…ythonGH-111453) * Remove mention of "vsapi" element type from the documentation. * Add tests for element_create() and other ttk.Style methods. * Add examples for element_create() in the documentation.
…ythonGH-111453) * Remove mention of "vsapi" element type from the documentation. * Add tests for element_create() and other ttk.Style methods. * Add examples for element_create() in the documentation.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: