-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
tkinter breaks when mixing tk.Checkbutton and ttk.Checkbutton #116484
Comments
If you do not pass a name to the widget constructor, tkinter generates a default name, which is the lowercase widget name plus sequence number for that widget class, starting with '1'. Since those are the second widgets for each class, the names are correct; no bug. If you delete the first tk Checkbutton and add a 2nd ttk Checkbutton before the print, you will see 1 and 3. I think this should be closed. @serhiy-storchaka ? If you pack a widget in a frame packed in root and print the widget rather than its specific |
Thank you for your report @BartolHrg. It shows the flaw in the solution for #73588.
The solution is to use different templates for generating names, so the results are different even if the class name and the counter are the same. |
@terryjreedy generated names are not based directly on class but on the previous equal names. Another solution, since the method |
|
…ault names (GH-116495) Change automatically generated tkinter.Checkbutton widget names to avoid collisions with automatically generated tkinter.ttk.Checkbutton widget names within the same parent widget.
…on default names (pythonGH-116495) Change automatically generated tkinter.Checkbutton widget names to avoid collisions with automatically generated tkinter.ttk.Checkbutton widget names within the same parent widget. (cherry picked from commit c61cb50) Co-authored-by: Serhiy Storchaka <[email protected]>
…on default names (pythonGH-116495) Change automatically generated tkinter.Checkbutton widget names to avoid collisions with automatically generated tkinter.ttk.Checkbutton widget names within the same parent widget. (cherry picked from commit c61cb50) Co-authored-by: Serhiy Storchaka <[email protected]>
…ton default names (GH-116495) (GH-116901) Change automatically generated tkinter.Checkbutton widget names to avoid collisions with automatically generated tkinter.ttk.Checkbutton widget names within the same parent widget. (cherry picked from commit c61cb50) Co-authored-by: Serhiy Storchaka <[email protected]>
…ton default names (GH-116495) (GH-116902) Change automatically generated tkinter.Checkbutton widget names to avoid collisions with automatically generated tkinter.ttk.Checkbutton widget names within the same parent widget. (cherry picked from commit c61cb50) Co-authored-by: Serhiy Storchaka <[email protected]>
…on default names (pythonGH-116495) Change automatically generated tkinter.Checkbutton widget names to avoid collisions with automatically generated tkinter.ttk.Checkbutton widget names within the same parent widget.
…on default names (pythonGH-116495) Change automatically generated tkinter.Checkbutton widget names to avoid collisions with automatically generated tkinter.ttk.Checkbutton widget names within the same parent widget.
…on default names (pythonGH-116495) Change automatically generated tkinter.Checkbutton widget names to avoid collisions with automatically generated tkinter.ttk.Checkbutton widget names within the same parent widget.
Bug report
Bug description:
When mixing tk.Checkbutton and ttk.Checkbutton (and maybe custom class Checkbutton)
tkinter behaves weirdly (calling method of one object changes the other too).
It is because of name collision.
this example prints
This happens because of
tk.Checkbutton._setup
overriden methodwhich is not called in ttk.Checkbutton.
I think that that method can be erased, which would solve the problem,
but I'm not sure why it is there in the first place.
CPython versions tested on:
3.12
Operating systems tested on:
Windows
Linked PRs
The text was updated successfully, but these errors were encountered: