This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author 23412343214312
Recipients 23412343214312, gpolo, serhiy.storchaka
Date 2020-09-30.18:28:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This issue occurs when using the current mouse position from an event and the wordstart expression to find the index of the start of a clicked word on a text widget and the indices for the clicked word are tagged. If there's a single non-alphanumberic and underline character between the clicked word and the left edge of the text widget the index return for the start of the word will be the one for said non-alphanumeric and underline character. 

test.index(('@%s,%s wordstart' % (event.x, event.y)))

Assuming "[testing]" is at the indices 1.0 to 1.9 of a text widget, clicking on testing will return 1.1. If we tag the indices 1.1 to 1.8 with test.tag_add("tag", 1.1, 1.8) then clicking on the word testing will return 1.0. This change of return doesn't occur if "[testing]" does not begin at a x.0 index or if there's multiple non-alphanumeric and underline characters such as "[[testing]". Using wordend will return 1.8 in both tagged and non tagged scenarios.

The attached script illustrates this bug, only the middle text widget will print out the unexpected start index when clicking on the word testing. This issue isn't present when using python 3.5, running the script on python 3.5 will print out all expected indices.
Date User Action Args
2020-09-30 18:28:1023412343214312setrecipients: + 23412343214312, gpolo, serhiy.storchaka
2020-09-30 18:28:1023412343214312setmessageid: <>
2020-09-30 18:28:1023412343214312linkissue41896 messages
2020-09-30 18:28:1023412343214312create