On Sun, May 4, 2008 at 5:28 PM, Valerio Valerio <[EMAIL PROTECTED]> wrote: > 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. -- http://mail.python.org/mailman/listinfo/python-list