[Tutor] How to capture 'Ctrl+c' in Python
pyro9219 at gmail.com
Fri Nov 3 08:25:40 CET 2006
I'm not sure where I got this from, but I think its from your site..
if key == '\x00' or key == '\xe0': # non ASCII
key = msvcrt.getch() # fetch second character
# First, clear the screen of clutter then warn the user
# of what to do to quit
lines = 25 # set to number of lines in console
for line in range(lines): print
print "Hit space to end..."
# Now mainloop runs "forever"
ky = msvcrt.getch()
length = len(ky)
if length != 0:
# send events to event handling functions
if ky == " ": # check for quit event
On 11/2/06, Alan Gauld <alan.gauld at btinternet.com> wrote:
> "Chris Hengge" <pyro9219 at gmail.com> wrote
> > Do you by chance know of a way to capture special keys like "Print
> > Screen"?
> Try the key capture code in my Event Driven topic.
> So far as I know it works for all keys including the special ones.
> It also points out that those keys have a two part code...
> Alan Gauld
> Author of the Learn to Program web site
> Tutor maillist - Tutor at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor