Skip to content

gh-68166: Add support of "vsapi" in ttk.Style.element_create() #111393

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

Merged

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Oct 27, 2023

  • Fix and document Add 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.

📚 Documentation preview 📚: https://cpython-previews--111393.org.readthedocs.build/

* 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.
@terryjreedy
Copy link
Member

I verified that the reproducer in the issue still fails main and runs with the patch.

@@ -1392,7 +1392,7 @@ option. If you don't know the class name of a widget, use the method

Create a new element in the current theme, of the given *etype* which is
expected to be either "image", "from" or "vsapi". The latter is only
available in Tk 8.6a for Windows XP and Vista and is not described here.
available in Tk 8.6a for Windows XP and Vista.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have never heard of 'Tk 8.6a'; seems like a typo. XP is no longer supported and 8.5 is not supported on Windows. Is Vista still supported? https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_vsapi.html does say just xp/vista, but does tk not support Win 10/11 'visual styles'?

In any case, the issue test code passing 'vsapi' runs on 8.6.13 on Win 10. Does it do nothing on Win 10? Given

>>> ttk.Style().theme_names()
('winnative', 'clam', 'alt', 'default', 'classic', 'vista', 'xpnative')

the vsapi tests run (and pass on my machine), so my guess is that xp/vista themes are still available and usable. If so, the doc should not suggest not. Perhaps

Suggested change
available in Tk 8.6a for Windows XP and Vista.
available for Windows and only supports the XP theme.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that 8.6a refers to the alpha version of 8.6 (perhaps it was in the alpha stage when this was added).

"and only supports the XP theme" is not correct. You can use it in any theme, you can create XP-like or Vista-like theme using this API (and the "vista" theme is created in Tk by calling such commands). I left "available in Tk 8.6 on Windows" (there are other references to 8.6 and 8.5 in docs).

@serhiy-storchaka serhiy-storchaka added type-feature A feature request or enhancement and removed needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes type-bug An unexpected behavior, bug, or error labels Nov 8, 2023
@serhiy-storchaka serhiy-storchaka changed the title gh-68166: Fix support of "vsapi" in ttk.Style.element_create() gh-68166: Add support of "vsapi" in ttk.Style.element_create() Nov 8, 2023
@serhiy-storchaka
Copy link
Member Author

Now it is a new feature and will not be backported.

@serhiy-storchaka serhiy-storchaka merged commit 4dcfd02 into python:main Nov 27, 2023
@serhiy-storchaka serhiy-storchaka deleted the ttk-style-element-create branch November 27, 2023 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-tkinter type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants