Mouse action: Right click,mouseclick,from Tkinter
文章由Byrx.net分享于2019-03-23 06:03:42
Mouse action: Right click,mouseclick,from Tkinter
from Tkinter import *def showPosEvent(event): print 'Widget=%s X=%s Y=%s' % (event.widget, event.x, event.y)def onRightClick(event): print 'Got right mouse button click:', showPosEvent(event)tkroot = Tk()labelfont = ('courier', 20, 'bold') widget = Label(tkroot, text='Hello bind world')widget.config(bg='red', font=labelfont) widget.config(height=5, width=20) widget.pack(expand=YES, fill=BOTH)widget.bind('<Button-3>', onRightClick) widget.focus() tkroot.title('Click Me')tkroot.mainloop()
相关内容
- Append element to a list,appendelement,scores = ['1
- Empety list multiply,empetymultiply,L = [None] *
- Negative List Indices,negativeindices,li = ['a', '
- Get length of a list,getlength,print len([1
- Delete an element from a list,deleteelement,scores = ['1
- List repetition,listrepetition,print ['Ni!'
- A list of lists: nested list,listsnested,words = 'The
- Use Print to display tuples,displaytuples,chest = ('go
- in function for a string and a tuple,functiontuple,S, T = 'lumb
- Iterate over a string and tuple,iteratetuple,S = 'lumberj
评论关闭