View Single Post
Join Date: Feb 2007
Posts: 77
Reputation: aot is an unknown quantity at this point 
Solved Threads: 1
aot's Avatar
aot aot is offline Offline
Junior Poster in Training

Re: KeyPress event with holding down the key

 
0
  #4
Feb 23rd, 2007
Okay, I've been testing out your advice with my code. Maybe I'm being thick, but so far it's just not working. Here's what I've got:

  1. self.go = False
  2.  
  3. self.innerframe = Frame(frame)
  4. self.innerframe.bind('<a>', self.showJudgments)
  5. self.innerframe.bind('<KeyRelease-a>', self.makeChoice)
  6. self.innerframe.pack(expand=YES, fill=BOTH)
  7. self.innerframe.focus_force()
  8.  
  9. def showJudgments(self, event=None):
  10. if self.go == False:
  11. self.go = True
  12. self.showJudgmentsA()
  13. else:
  14. self.keepShowing()
  15.  
  16. def keepShowing(self):
  17. print 'a key being pressed'

Yet what happens when I hold the 'a' key is that both showJudgmentsA and makeChoice immediately get called over and over again, and keepShowing never gets called. I just don't get it.
Reply With Quote