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

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"<B1-Motion>", self.mouseDragged )

   def mouseDraggedself, event ):
      self.mousePosition.set"Dragged 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