Image grab in Python

David wizzardx at gmail.com
Sun May 4 14:09:37 EDT 2008


> 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.
>

If it's your apps own window, then getting a rectangle selected by the
user is simple.

1) Make skeleton x/gtk/wx/qt/etc app
2) Add code to show an image
3) Add code to capture mouse events
4) Add code to show the 'rubber band' rectangle over the mouse selection area
5) When the user releases the mouse, then extract the part of the
rectangle between where a mouse button was clicked and where it was
released.

All this would be in the docs for the Python x/gtk/wx/qt/etc libs.
Where is the difficulty?

David.



More information about the Python-list mailing list