[issue46052] Ctrl+C, C+V in tk.Text on Windows do not work with Cyrillic keys

Terry J. Reedy report at bugs.python.org
Sun Dec 12 11:55:04 EST 2021


Terry J. Reedy <tjreedy at udel.edu> added the comment:

It appears that your particular keyboard program is translating Ctrl + letter key combinations to something other than the default Ascii Control-letter code.  Do you see the same problem with Notepad?  To test what tcl/tk and hence tkinter see, expand the test code to

import tkinter as tk
r = tk.Tk()
t = tk.Text(r)
t.pack()

def keyevent(e):
    if c := e.char:
        print(f'char: {c}, ord: {ord(c)}, ', end='')
    print(f'code: {e.keycode}, sym: {e.keysym}, num: {e.keysym_num}.')
t.bind('<Key>', keyevent)

If I type c and ctrl + c in the tk box, I see the following in either the IDLE Shell or Command Prompt.

char: c, ord: 99, code: 67, sym: c, num: 99.
code: 17, sym: Control_L, num: 65507.
char: , ord: 3, code: 67, sym: c, num: 99.

I expect the third line will be different for you when you switch to Russian.

Your immediate fix is to use either the IDLE Edit menu or the right-click context menu to access copy and paste functions.  A longer term fix might be to get a different Russian keyboard program.

Assuming that I am correct above, I will make this an IDLE doc issue to add something about non-ascii keyboard issues, and include the test program above.

----------
title: Ctrl+C, C+V in IDLE on Windows do not work with Cyrillic keys -> Ctrl+C, C+V in tk.Text on Windows do not work with Cyrillic keys

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46052>
_______________________________________


More information about the Python-bugs-list mailing list