Key action : Key Action : Event PYTHON examples


PYTHON examples » Event » Key Action »

 

Key action


Key action: Key released

from Tkinter import *

class KeyDemoFrame ):
   def __init__self ):
      Frame.__init__self )
      self.packexpand = YES, fill = BOTH )
      self.master.title"Demonstrating Keystroke Events" )
      self.master.geometry"350x50" )

      self.message1 = StringVar()
      self.line1 = Labelself, textvariable = self.message1 )
      self.message1.set"Type any key or shift" )
      self.line1.pack()

      self.message2 = StringVar()
      self.line2 = Labelself, textvariable = self.message2 )
      self.message2.set"" )
      self.line2.pack()

      self.master.bind"<KeyRelease>", self.keyReleased )

   def keyReleasedself, event ):
      self.message1.set"Key released: " + event.char )
      self.message2.set"This key is not left shift" )
   
def main():
   KeyDemo().mainloop()

if __name__ == "__main__":
   main()

           
       



Leave a Comment / Note


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


PYTHON examples

 Navioo Event
» Key Action