开发者

Python/Tkinter: Getting the full Event name?

How do I get th开发者_开发问答e full name of an event? For example, Event.keysym only shows "c" for an event triggered by "<Control-c>". How can I get the "Control" too?


Event.state holds the OR'd together states of the modifier keys. So you could try something like:

modifiers = []
if event.state & 1:
    modifiers.append('Shift')
if event.state & 4:
    modifiers.append('Control')
# ... etc
print '-'.join(modifiers)

See here for more details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜