How to do it for the Russian layout Control-Ч ?
event.widget.event_generate('<Control-X>') You can use Event.keycode . Thus, everything will not depend on the layout. For example, for your case ( Ctrl-H and Crtl-X )
from tkinter import * root = Tk() def keys(event): if event.keycode==88: # Клавиша с буквой Ч и с англ. буквой X print("Ура! Вы нажали Ctrl-Ч! (Или Ctrl-X)") root.bind("<Control-KeyPress>",keys) root.mainloop() PS: Sorry, I don’t know about Event.generate (((
Control-KeyPress-multiply - for large H Control-KeyPress-division - for small h
Source: https://ru.stackoverflow.com/questions/588519/
All Articles