[Tutor] Print Screen
Chris Hengge
pyro9219 at gmail.com
Fri Nov 3 09:08:19 CET 2006
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> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061103/7f2cbe57/attachment.htm
More information about the Tutor
mailing list