[Tutor] Print Screen

Jonathon Sisson sisson.j at gmail.com
Sat Nov 4 04:14:36 CET 2006


I don't know if this has been mentioned yet, but this site might be useful:


The code base has (last I heard) fallen stagnant, but it may very well 
be worth a look as a starting point for your VNC project idea.


Chris Hengge wrote:
> Wow.. I have visions of writing a little wanna-be VNC client/server now 
> using the ImageGrab.grab() =D
> This ImageGrab trick does exactly what I wanted. Thanks for the tip!
> Actually, I want to write a little package for the learning experience 
> sometime over the holidays (plus I use VNC fairly often), but I can't 
> find any direction, or any already made packages for python for the VNC 
> protocol (no libs?).
> On 11/2/06, *Luke Paireepinart* <rabidpoobear at gmail.com 
> <mailto:rabidpoobear at gmail.com>> wrote:
>      >> Anyone know of a way to capture special keys like "Print Screen"?
>      >> I have a small script to grab all they keycodes, but it doesn't
>     seem to
>      >> catch several keys on the keyboard. I've got a utility that I'd
>     like to
>      >> be able to automagically get a screenshot when something goes
>     wrong so I
>      >> dont have to hope the user can re-create the error. Universal
>     support
>      >> would be best, but WinXP is the main OS
>      >>
>      >>
>      >
>      > I'm not exactly sure what you want here :-) but if you want to
>     capture
>      > when the 'Print Screen' key (or any other key) has actually been
>      > pressed, try pyHook. Note: pyHook only works on Windows!
>      >
>     Also note that if you want all of the keypresses, but you _don't_ care
>     about the application with focus
>     receiving the input, you can do a complete key grab using TKInter or
>     Pygame, and probably the other GUI packages too.
>     But, like I said, if you were, for example, typing an e-mail and you
>     started a script that did a complete grab like this, you'd no longer be
>     able to type
>     into the e-mail window.  Using pyHook, your program could see all the
>     keypresses, but they'd also still be sent to the e-mail program.
>     Actually, I've never tried it, but I'm pretty sure that's how the GUI
>     packages' key capturing works.
>     You may be asking 'well, it sounds like pyHook does a better job of
>     this
>     anyway!'
>     Yeah, you're right.
>     However, as Alan exclaimed, pyHook works only on Windows!
>     So the solution I offered would be more portable.
>     Hope that helps,
>     -Luke
> ------------------------------------------------------------------------
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

More information about the Tutor mailing list