Hi,<br><br><div class="gmail_quote">2008/5/4 David <<a href="mailto:wizzardx@gmail.com">wizzardx@gmail.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Sun, May 4, 2008 at 5:28 PM, Valerio Valerio <<a href="mailto:vdv100@gmail.com">vdv100@gmail.com</a>> wrote:<br>
> I can grab the image, I need a way of grab the region size with the mouse,<br>
> a easy way of the user select a region of the image to analyze, something<br>
> like the "Rectangle selection tool" of gimp.<br>
><br>
<br>
</div>I assume what you want to do is allow the user to drag the mouse<br>
across your desktop, and your program, running in the background,<br>
picks this up? As opposed to the user making a rectangular selection<br>
entirely within your app.</blockquote><div> </div><div>What I want is display a window with a image, the user select a region of the image, and the region value is passed to my program, my program slice the image region, and analyze it.<br>
<br>I think the Xlib libraries can help in my task, thanks for the help :)<br><br>Cheers,<br><br>-- <br>Valério Valério<br><br><a href="http://www.valeriovalerio.org">http://www.valeriovalerio.org</a>
<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
I think the simplest way to do this is to capture the entire screen,<br>
then show it as an image on a window covering the entire screen (eg:<br>
fullscreen mode, or a regular window without decorations). Then<br>
listen for mouse events. There should be a way to show the 'rectangle<br>
elastic band' at the same time. Otherwise just draw a rectangle<br>
between where the user first clicked and where the mouse is now (until<br>
they release the mouse button).<br>
<br>
Another way would be to listen to all events sent through X, and act<br>
based on the mouse events. VNC does something similar.<br>
<br>
A good starting point would be the Python xlib libraries:<br>
<br>
<a href="http://python-xlib.sourceforge.net/" target="_blank">http://python-xlib.sourceforge.net/</a><br>
<font color="#888888"><br>
David.<br>
</font></blockquote></div><br><br clear="all"><br><br>