Mouse button differentiation: center button clic,,from Tkinter
Mouse button differentiation: center button clic,,from Tkinter
from Tkinter import *class MouseDetails( Frame ): def __init__( self ): Frame.__init__( self ) self.pack( expand = YES, fill = BOTH ) self.master.title( 'Mouse clicks and buttons' ) self.master.geometry( '350x150' ) self.mousePosition = StringVar() positionLabel = Label( self, textvariable = self.mousePosition ) self.mousePosition.set( 'Mouse not clicked' ) positionLabel.pack( side = BOTTOM ) self.bind( '<Button-2>', self.centerClick ) def centerClick( self, event ): self.showPosition( event.x, event.y ) self.master.title( 'Clicked with center mouse button' ) def showPosition( self, x, y ): self.mousePosition.set( 'Pressed at [ ' + str( x ) + ', ' + str( y ) + ' ]' ) def main(): MouseDetails().mainloop()if __name__ == '__main__': main()
- 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
- List: less,equal,greater: tuple of results,greatertupl
热门文章:
相关内容
- 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', '
- List for iteration,listforiteration,for x in [1,
评论关闭