[PyQt] Where to start

David Boddie david at boddie.org.uk
Fri Jun 3 01:06:38 BST 2011


On Thu Jun 2 23:07:12 BST 2011, Brickle Macho wrote:

> I am trying to do is display an image, and then using drag-selection to
> select a sub-image for later processing.   Eventually I want to be able
> to select multiple regions and tag each region for appropruate back end
> processing, but for now just being able to select one sub-image would be
> good.      I can display an image, but don't know how to implement
> drag-selection (think it is also know as rubber band selection).  I am
> assuming I will need to write some mouse-callbacks or something.  My
> search-fu has failed me and I haven't been able to find any examples to
> study.    Can someone give me any pointers to which widgets I should be
> using and perhaps where to find a sample program I can study.

There didn't seem to be much in the PyQt examples to show this - the
itemviews/chart example does use QRubberBand to allow the user to select
data, but that's not the best example to learn this technique from.

I quickly wrote an example that does part of what you want:

http://www.diotavelli.net/PyQtWiki/Selecting_a_region_of_a_widget

Hope this helps,

David


More information about the PyQt mailing list