Mailing List Archive

[issue45796] Using tab to cycle through tkinter widgets breaks foreground styling
Chris Eykamp <chris@eykamp.com> added the comment:

I'll add that when the red text incorrectly turns black, on my display, I can see a very subtle red halo, as if the text is being printed first as red, then as black in a second pass.

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue45796>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue45796] Using tab to cycle through tkinter widgets breaks foreground styling [ In reply to ]
New submission from Chris Eykamp <chris@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 <report@bugs.python.org>
<https://bugs.python.org/issue45796>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue45796] Using tab to cycle through tkinter widgets breaks foreground styling [ In reply to ]
E. Paine <xepaine13@gmail.com> added the comment:

I believe this is just because the `selectbackground` is only shown when the widget has focus. Try, for example, only selecting part of the text and then tabbing off. Therefore, I think this is not a bug. The only thing which makes me slightly doubt myself is that this behaviour is platform-specific, and not reproducible on Linux, but this could just be down to Windows design guidelines.

IMO, this issue should be closed as "not a bug". If you think this is an issue that should be taken further, please raise it with the Tk team: https://core.tcl-lang.org/tk/reportlist

----------
nosy: +epaine, serhiy.storchaka

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue45796>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue45796] Using tab to cycle through tkinter widgets breaks foreground styling [ In reply to ]
Chris Eykamp <watusimoto@bitfighter.org> added the comment:

The behavior I described is definitely a bug, though it may be (and I suspect is) Windows specific. You may also be right that the problem is upstream, but please don't declare this "not a bug" until you've tested it on Windows.

----------
nosy: +watusimoto2

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue45796>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue45796] Using tab to cycle through tkinter widgets breaks foreground styling [ In reply to ]
E. Paine <xepaine13@gmail.com> added the comment:

> please don't declare this "not a bug" until you've tested it on Windows

Sorry, I didn't explain my reasoning for that resolution. I did test it on Windows, but my trail of though went something like: "unexpected behaviour doesn't necessarily mean it's a bug". You are right, though, and a resolution of "third party" would be more suitable.

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue45796>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue45796] Using tab to cycle through tkinter widgets breaks foreground styling [ In reply to ]
Chris Eykamp <chris@eykamp.com> added the comment:

Thanks for the clarification. I don't want to belabor the point, but if you observe what happens as you hit tab and cycle through the widgets, the way the color changes cannot be intended behavior, and makes no sense from any rational UI perspective.

I do accept that it may not be a Python bug (though I don't really know); I do not understand the relationship between Python and Tcl in terms of who is responsible for what. But regardless, I filed a bug report at the URL you provided. I don't know if they accept documentation of problems written in Python, and I cannot write the code in Tcl, but we'll find out in a day or two (I hope).

Thanks again!

On Tue, Nov 16, 2021, at 13:35, E. Paine wrote:
> E. Paine <xepaine13@gmail.com> added the comment:
>
>> please don't declare this "not a bug" until you've tested it on Windows
>
> Sorry, I didn't explain my reasoning for that resolution. I did test it
> on Windows, but my trail of though went something like: "unexpected
> behaviour doesn't necessarily mean it's a bug". You are right, though,
> and a resolution of "third party" would be more suitable.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue45796>
> _______________________________________

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue45796>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue45796] Using tab to cycle through tkinter widgets breaks foreground styling [ In reply to ]
Change by Ned Deily <nad@python.org>:


----------
resolution: -> third party
stage: -> resolved
status: open -> closed

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue45796>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue45796] Using tab to cycle through tkinter widgets breaks foreground styling [ In reply to ]
Ned Deily <nad@python.org> added the comment:

For the record, the Tk issue opened for this is at:
https://core.tcl-lang.org/tk/tktview?name=300bad1beb

----------
nosy: +ned.deily

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue45796>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue45796] Using tab to cycle through tkinter widgets breaks foreground styling [ In reply to ]
Chris Eykamp <chris@eykamp.com> added the comment:

If we decide that this is a tkinter bug (and that the Python part is working properly), does that mean that we close this ticket and rely on the upstream provider to fix the problem? I don't know how jurisdiction works with core libraries shipped with Python.

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue45796>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue45796] Using tab to cycle through tkinter widgets breaks foreground styling [ In reply to ]
Ned Deily <nad@python.org> added the comment:

This issue was already closed under the presumption that what you described is Tk behavior. tkinter is the module in the Python standard library that provides the “glue” to the third-party TCL and Tk libraries; it is pretty much a thin wrapper that provides little functionality on its own. If the Tk folks ultimately reject your Tk issue and believe it is really a problem in Python’s tkinter module, feel free to reopen this issue. (Note, that in general, the Tcl and Tk libraries themselves are not part of Python, however we do provide pre-compiled versions of the libraries with the the Windows and macOS Python binary installers on python.org.)

----------

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