Skip to content
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

ttkwidgets.CheckboxTreeview can't appear background color on selected items. #70

Open
water5 opened this issue Jan 2, 2021 · 1 comment
Assignees
Labels

Comments

@water5
Copy link

water5 commented Jan 2, 2021

This's use ttkwidgets.CheckboxTreeview:
Image

this's use ttk.Treeview:
Image

@RedFantom
Copy link
Member

This is actually not unexpected behaviour. CheckboxTreeview uses a custom style named Checkbox.Treeview, which you'll have to modify yourself if you want this behaviour. If you were to use ttkthemes, for example:

root = ThemedTk(theme="plastik")

tree = CheckboxTreeview(root)
style = ttk.Style(root)
style.map("Checkbox.Treeview",
    background=[
        ("disabled", "#E6E6E6"),
        ("selected", style.lookup("Treeview", "background", ("selected",)))
    ])
tree.pack()

You can modify this snippet for doing this for all states you want to mimic. There's an argument to be made here for implementing this as the default behaviour, but then there's the problem of this custom style not updating after theme change (so if you create the Treeview first and then set the theme for your application, it's not going to work). So overall, for now I advise you to do it in this explicit manner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants