Mouse events on a frame: Mouse,mouseevents,from Tkinter
Mouse events on a frame: Mouse,mouseevents,from Tkinter
from Tkinter import *class MouseLocation( Frame ): def __init__( self ): Frame.__init__( self ) self.pack( expand = YES, fill = BOTH ) self.master.title( 'Demonstrating Mouse Events' ) self.master.geometry( '275x100' ) self.mousePosition = StringVar() # displays mouse position self.mousePosition.set( 'Mouse outside window' ) self.positionLabel = Label( self, textvariable = self.mousePosition ) self.positionLabel.pack( side = BOTTOM ) self.bind( '<B1-Motion>', self.mouseDragged ) def mouseDragged( self, event ): self.mousePosition.set( 'Dragged at [ ' + str( event.x ) + ', ' + str( event.y ) + ' ]' )def main(): MouseLocation().mainloop()if __name__ == '__main__': main()
- Mouse button differentiation: center button clic,,from
- Mouse Double click,mousedoubleclick,from Tkinter
- Mouse action: left click,mouseclick,from Tkinter
- Draw a Oval with fill,drawoval,from Tkinter
- List: The Difference Between Extend and Append,extenda
- How to Create and Assign Lists,assignlists,aList = [12
热门文章:
相关内容
- Mouse button differentiation: center button clic,,from Tkinter
- Mouse Double click,mousedoubleclick,from Tkinter
- Mouse action: left click,mouseclick,from Tkinter
- Draw a Oval with fill,drawoval,from Tkinter
- List: The Difference Between Extend and Append,extendappend,li = ['
- How to Create and Assign Lists,assignlists,aList = [123
- List: less,equal,greater: tuple of results,greatertuple,L1 = [1, ('
- Find Prime numbers using list,primenumbers,#First build
- List count(x),listcount,# Return the
- Introducing List Filtering,,li = ['a', '
评论关闭