Terry J. Reedy added the comment:
You should have uploaded your .py file. Mine is attached, with fix added.
Anyway, confirmed with 3.5.1, Win10. Slightly more bizarre than described, in
that misspelling disappears on even insertion and reappears in odd insertion.
this worsk
this worksthis works
this worksthis worksthis worsk
Even stranger, printing the txt to Shell after the insertion shows the opposite
parity.
this works
this worksthis worsk
this worksthis worksthis works
Binding to another key removes the problem. By experiment, ^t in Text means
'transpose chars to left and right of cursor and move cursor right' or
equivalently, 'move char to right before the one on left'. So 'abc|def'
becomes 'abdc|ef' (where '|' here represents the cursor, not a character. The
exception is that at the end of the text, the two chars to the left are
transposed, so that 'abc|' becomes 'acb|'.
Tk.bind has an 'add' parameter that defaults to None, which should mean
'replace previous bindings'. But I suspect that this only applies to
user-added bindings, so not replacing a default Text binding is not considered
a bug.
Serhiy, am I correct here or is this a tk or tkinter bug?
In fact, it seems that this default binding cannot be unbound. Adding
'txt.unbind('<Control-c>') did not work. Adding "return 'break'" at the end of
the callback does work.
Bottom line: make sure that you bind to an unused sequence or add the return to
disable any unused binding you do not know about.
Our doc is deficient, but correcting that is beyond the scope of this issue.
Unless I have missed something, this should be closed as 'not a bug'.
----------
nosy: +serhiy.storchaka, terry.reedy
versions: +Python 3.5 -Python 3.4
Added file: http://bugs.python.org/file41631/tem.py
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26085>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com