Mouse button differentiation: Mouse click,,from Tkinter
Mouse button differentiation: Mouse click,,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-1>', self.leftClick ) def leftClick( self, event ): self.showPosition( event.x, event.y ) self.master.title( 'Clicked with left 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 button differentiation: Right Button click,,from
- Menu item mouse on (active) foreground color,mousefore
- Canvas paint program: drag and draw,canvasdrag,from Tk
- Draw Math Curve,drawmathcurve,from Tkinter
- Set Button style: font,buttonfont,from Tkinter
- List comprehensions: for and tuple,,print [x+y f
热门文章:
相关内容
- Mouse button differentiation: Right Button click,,from Tkinter
- Menu item mouse on (active) foreground color,mouseforeground,from T
- Canvas paint program: drag and draw,canvasdrag,from Tkinter
- Draw Math Curve,drawmathcurve,from Tkinter
- Set Button style: font,buttonfont,from Tkinter
- List comprehensions: for and tuple,,print [x+y f
- Assignment to slices: Remove some,assignmentslices,a = ['spam',
- Use in to check Membership,checkmembership,permissions
- Change individual elements of a list,individualelements,a = ['spam'
- List Delete: delete one item and delete an entire section,entiresec
评论关闭