469,917 Members | 1,700 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

Re: Image grab in Python

On Sun, May 4, 2008 at 5:28 PM, Valerio Valerio <vd****@gmail.comwrote:
I can grab the image, I need a way of grab the region size with the mouse,
a easy way of the user select a region of the image to analyze, something
like the "Rectangle selection tool" of gimp.
I assume what you want to do is allow the user to drag the mouse
across your desktop, and your program, running in the background,
picks this up? As opposed to the user making a rectangular selection
entirely within your app.

I think the simplest way to do this is to capture the entire screen,
then show it as an image on a window covering the entire screen (eg:
fullscreen mode, or a regular window without decorations). Then
listen for mouse events. There should be a way to show the 'rectangle
elastic band' at the same time. Otherwise just draw a rectangle
between where the user first clicked and where the mouse is now (until
they release the mouse button).

Another way would be to listen to all events sent through X, and act
based on the mouse events. VNC does something similar.

A good starting point would be the Python xlib libraries:

http://python-xlib.sourceforge.net/

David.
Jun 27 '08 #1
0 1729

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Gey-Hong Gweon | last post: by
3 posts views Thread by Catalin Lungu | last post: by
10 posts views Thread by John Smith | last post: by
8 posts views Thread by Lars Netzel | last post: by
reply views Thread by David | last post: by
2 posts views Thread by dschu012 | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.