I'm not sure where I got this from, but I think its from your site.. <br><br>import msvcrt<br><br>def doKeyEvent(key):<br> if key == '\x00' or key == '\xe0': # non ASCII<br> key = msvcrt.getch() # fetch second character
<br> print ord(key)<br><br>def doQuitEvent(key):<br> raise SystemExit<br><br><br># First, clear the screen of clutter then warn the user <br># of what to do to quit<br>lines = 25 # set to number of lines in console<br>
for line in range(lines): print<br><br>print "Hit space to end..."<br>print<br><br># Now mainloop runs "forever"<br>while True:<br> ky = msvcrt.getch()<br> length = len(ky)<br> if length != 0:<br>
# send events to event handling functions<br> if ky == " ": # check for quit event<br> doQuitEvent(ky)<br> else: <br> doKeyEvent(ky)<br><br><br><div><span class="gmail_quote">On 11/2/06,
<b class="gmail_sendername">Alan Gauld</b> <<a href="mailto:alan.gauld@btinternet.com">alan.gauld@btinternet.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>"Chris Hengge" <<a href="mailto:pyro9219@gmail.com">pyro9219@gmail.com</a>> wrote<br>> Do you by chance know of a way to capture special keys like "Print<br>> Screen"?<br><br>Try the key capture code in my Event Driven topic.
<br><br>So far as I know it works for all keys including the special ones.<br>It also points out that those keys have a two part code...<br><br>--<br>Alan Gauld<br>Author of the Learn to Program web site<br><a href="http://www.freenetpages.co.uk/hp/alan.gauld">
http://www.freenetpages.co.uk/hp/alan.gauld</a><br><br><br>_______________________________________________<br>Tutor maillist - <a href="mailto:Tutor@python.org">Tutor@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/tutor">
http://mail.python.org/mailman/listinfo/tutor</a><br></blockquote></div><br>