Mouse action: drag,mouseactiondrag,from Tkinter
Mouse action: drag,mouseactiondrag,from Tkinter
from Tkinter import *def showAllEvent(event): print event for attr in dir(event): print attr, '=>', getattr(event, attr) def showPosEvent(event): print 'Widget=%s X=%s Y=%s' % (event.widget, event.x, event.y)def onLeftDrag(event): print 'Got left mouse button drag:', 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('<B1-Motion>', onLeftDrag) widget.focus() tkroot.title('Click Me')tkroot.mainloop()
- Get an exception's argument,exceptionargument,
- Collecting Parameters,collecting,def print_pa
- Reading a file: readlines and xreadlines,,file = open(
- While loop demo,whileloopdemo,x = 1while x
- Collect command-line options in a dictionary,,def geto
- A trailing comma avoids the newline after the output,,
热门文章:
相关内容
- Get an exception's argument,exceptionargument,# try: nu
- Collecting Parameters,collecting,def print_pa
- Reading a file: readlines and xreadlines,,file = open(
- While loop demo,whileloopdemo,x = 1while x
- Collect command-line options in a dictionary,,def getopts(
- A trailing comma avoids the newline after the output,,a, b = 0, 1w
- dir() does not list the names of built-in functions and variables,b
- Russian encode,russianencode,title = u'\u
- Random integers produced by randrange.,integersrandrange,import ran
- Python object persistence for dictionary like object,pythonpersiste
评论关闭