Message258379
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'. |
|
Date |
User |
Action |
Args |
2016-01-16 10:29:48 | terry.reedy | set | recipients:
+ terry.reedy, serhiy.storchaka, fresh_nick |
2016-01-16 10:29:48 | terry.reedy | set | messageid: <1452940188.87.0.197978315503.issue26085@psf.upfronthosting.co.za> |
2016-01-16 10:29:48 | terry.reedy | link | issue26085 messages |
2016-01-16 10:29:47 | terry.reedy | create | |
|