Key event: function key and special key,eventfunction,import Tkint
Key event: function key and special key,eventfunction,import Tkint
import Tkinterfrom Tkinter import *root = Tk()prompt='Press a key'L = Label(root, text=prompt, width=len(prompt))L.pack()def key(event): if event.char==event.keysym: msg ='Normal Key %r' % event.char elif len(event.char)==1: msg ='Punctuation Key %r (%r)' % (event.keysym, event.char) else: msg ='Special Key %r' % event.keysym L.config(text=msg)L.bind_all('<Key>', key)root.mainloop()
- Searching strings for a substring: counting the occurren
- Key action: Right key,keyactionright,from Tkinter
- Cheap and simple API helper,cheaphelper,'''Cheap and
- Draw gif image,drawgifimage,from Tkinter
- Stripping whitespace from a string.,,string1 = '\
- aligning positive and negative numbers,aligningnegativ
热门文章:
相关内容
- Searching strings for a substring: counting the occurrences of a subs
- Key action: Right key,keyactionright,from Tkinter
- Cheap and simple API helper,cheaphelper,'''Cheap and
- Draw gif image,drawgifimage,from Tkinter
- Stripping whitespace from a string.,,string1 = '\
- aligning positive and negative numbers,aligningnegative,print ('% 5
- When the and-or Trick Fails,and-orfails,a = '' b = '
- Map string to sys.stout.write,mapsys.stout.write,import syssh
- Boolean operation in if,booleanoperation,# number <=
- Move what you drew on a canvas,drewcanvas,from Tkinter
评论关闭