Mouse button differentiation : Mouse Action : Event PYTHON examples


PYTHON examples » Event » Mouse Action »

 

Mouse button differentiation


Mouse button differentiation: center button clic




from Tkinter import *

class MouseDetailsFrame ):
   def __init__self ):
      Frame.__init__self )
      self.packexpand = YES, fill = BOTH )
      self.master.title"Mouse clicks and buttons" )
      self.master.geometry"350x150" )

      self.mousePosition = StringVar()
      positionLabel = Labelself,
         textvariable = self.mousePosition )
      self.mousePosition.set"Mouse not clicked" )
      positionLabel.packside = BOTTOM )

      self.bind"<Button-2>", self.centerClick )

   def centerClickself, event ):
      self.showPositionevent.x, event.y )
      self.master.title"Clicked with center mouse button" )

   def showPositionself, x, y ):
      self.mousePosition.set"Pressed at [ " + str", " +
         str" ]" )     

def main():
   MouseDetails().mainloop()

if __name__ == "__main__":
   main()

           
       



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Event
» Mouse Action