I've been trying to use binding to a KeyPress/KeyRelease such that a particular function runs as long as the key is pressed and ceases when it is released. However, it seems like my major problem is that most keys are considered to continually activate as long as you hold them down... so my function either appears to start over and over again or sometimes immediately ends right after the key is first pressed. Does anyone have any advice?
aot 0 Junior Poster in Training
Recommended Answers
Jump to PostThat may be tough because a continuous key press is interpreted by your operating system as a repeated key press.
Jump to Post...
P.S. Is there an easy way to copy/paste example code? Whatever I tried, I always ended up without tabbed spacing but with the unnecessary line numbers.For code enclosed in the [code=python] and [/code] tag pair, click on "Toggle Plain Text" so you can highlight and copy the …
Jump to PostYou will have to sit there with a stopwatch, but this could do the timing for you ...
# count how many times the keyboard is scanned on # one continuous keypress of character 'a' import Tkinter as tk class MyFrame(tk.Frame): def __init__(self, master): tk.Frame.__init__(self, master) # …
All 12 Replies
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
jrcagle 77 Practically a Master Poster
aot 0 Junior Poster in Training
jrcagle 77 Practically a Master Poster
aot 0 Junior Poster in Training
jrcagle 77 Practically a Master Poster
aot 0 Junior Poster in Training
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
jrcagle 77 Practically a Master Poster
aot 0 Junior Poster in Training
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
Quarks 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.