New submission from Chris Eykamp <ch...@eykamp.com>:

Attached is a slightly modifed example of the code sample in Bryan Oakley's 
response to:

https://stackoverflow.com/questions/30337351/how-can-i-ensure-my-ttk-entrys-invalid-state-isnt-cleared-when-it-loses-focus

I have modified it by changing the style.map to change the widget's foreground 
color (rather than background), and by adding a button below the text input.

Typing a string containing "invalid" into the textbox causes it to fail 
validation (its state is shown in the bottom label, updated every second).  As 
expected, the foreground changes to red.

However, if I use [tab] to toggle between the elements, the foreground of the 
text entry gets changed to black, even if the item is invalid.

Adding         
    style.map("TEntry",  selectforeground=[('invalid', "green")])
creates a new set of weirdness, where the invalid text becomes green when 
tabbing through the widgets.


I'm running on Windows 10, Python 3.83.

----------
components: Tkinter
files: simple.py
messages: 406242
nosy: watusimoto
priority: normal
severity: normal
status: open
title: Using tab to cycle through tkinter widgets breaks foreground styling
versions: Python 3.8
Added file: https://bugs.python.org/file50437/simple.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45796>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to