Button mouse action : Mouse Action : Event PYTHON examples


PYTHON examples » Event » Mouse Action »

 

Button mouse action


Button mouse action: mouse in, out and rollover


# Button demonstration.

from Tkinter import *
from tkMessageBox import *

class PlainAndFancyFrame ):
   def __init__self ):
      Frame.__init__self )
      self.packexpand = YES, fill = BOTH )
      self.master.title"Buttons" )

      self.plainButton = Buttonself, text = "Plain Button"
                                   command = self.pressedPlain )
      self.plainButton.bind"<Enter>", self.rolloverEnter )
      self.plainButton.bind"<Leave>", self.rolloverLeave )
      self.plainButton.packside = LEFT, padx = 5, pady = )

   def pressedPlainself ):
      showinfo"Message""You pressed: Plain Button" )

   def rolloverEnterself, event ):
      event.widget.configrelief = GROOVE )

   def rolloverLeaveself, event ):
      event.widget.configrelief = RAISED )

def main():
   PlainAndFancy().mainloop()

if __name__ == "__main__":
   main()

           
       



Leave a Comment / Note


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


PYTHON examples

 Navioo Event
» Mouse Action