Mouse events on a frame : Mouse Action : Event PYTHON examples


PYTHON examples » Event » Mouse Action »

 

Mouse events on a frame


Mouse events on a frame: Mouse released, position

from Tkinter import *

class MouseLocationFrame ):
   def __init__self ):
      Frame.__init__self )
      self.packexpand = 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 = Labelself,
         textvariable = self.mousePosition )
      self.positionLabel.packside = BOTTOM )

      self.bind"<ButtonRelease-1>", self.buttonReleased )   

   def buttonReleasedself, event ):
      self.mousePosition.set"Released at [ " + strevent.x 
         ", " + strevent.y " ]" )

def main():
   MouseLocation().mainloop()

if __name__ == "__main__":
   main()

           
       



Leave a Comment / Note


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


PYTHON examples

 Navioo Event
» Mouse Action