Skip to content

tkinter breaks when mixing tk.Checkbutton and ttk.Checkbutton #116484

Closed
@BartolHrg

Description

@BartolHrg

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.

import tkinter as tk
from tkinter import ttk
wn = tk.Tk()
tk.Checkbutton(wn)
ttk.Checkbutton(wn)
print(tk.Checkbutton(wn).winfo_name())
print(ttk.Checkbutton(wn).winfo_name())

this example prints

!checkbutton2
!checkbutton2

This happens because of tk.Checkbutton._setup overriden method
which 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions