Python Forum
A problem with a TButton's foreground 'active' color.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A problem with a TButton's foreground 'active' color.
My program runs a timing loop and has 13 widgets in the window, four are buttons. The style map sets the button's 'active' foreground color to red, and it works as expected on three of the buttons. The situation is with the 'stop'/'reset' button. The 'stop' button interrupts the decrement loop and becomes a 'reset' button, which cleans the slate and gets ready for the next timing. The 'reset' button's state is initially set 'disabled' so it won't be clicked early, before the decrement loop completes it's cycle, which causes errors. When the decrement loop is stopped, and just before it returns 0, the 'reset' button's state is set to 'normal'. And here is the situation, the mouse cursor is still on the button, but the now-normal button doesn't know it should be 'active', so the text is not red. I can move the mouse off the button and back on, and get red text, as expected.

I have set the button state to 'active' and the text is red, but the problem is reversed. It stays red until I move the mouse back on and off the button.

So here's the question, is there a way for the program to interrogate the button to determine if there's a mouse cursor on it, and change to the appropriate state?


Linux Mint, python3.8, ttk widgets

Possibly Related Threads…
Thread Author Replies Views Last Post
  Read and write active Excel file euras 4 533 Jun-29-2021, 11:16 PM
Last Post: Pedroski55
  Active Directory add an attribute. SpongeB0B 2 732 Oct-13-2020, 05:36 AM
Last Post: SpongeB0B
  Edit Open and Active Excel sheet in Python JoeDainton123 1 754 Jul-29-2020, 12:52 AM
Last Post: Larz60+
  Current foreground application tibegato 4 1,062 May-25-2020, 12:47 AM
Last Post: tibegato
  Python3/Flask/LDAP-Active Directory tundrwd 1 1,102 Dec-13-2019, 05:48 PM
Last Post: Clunk_Head

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020