Skip to content

How to change button color based on external action? #1752

Answered by djhunter67
djhunter67 asked this question in Support
Discussion options

You must be logged in to vote

`def callstack(sender, app_data, user_data) -> None:
"""Relational connection between GUI and class"""

match user_data:
    case 1:
        #dpg.configure_item(item="stats_1", show=False)  # Only made indicator dissapear
        dpg.bind_item_theme(f"stats_1", orng_btn_theme)  # Effectively changed color in real time`

Solution here is to put the identical dpg.bind_item_theme inside the callback function. This apparently overwrites the original dpg.bind_item_theme that holds the buttons origonal color.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by djhunter67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
1 participant