Skip to content

ashokfernandez/wxPython-Rectangle-Selector-Panel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Rectangle Selector Panel

Date : 05 / 12 / 2013

Description:

Select an area on an image using a click and drag rectangle in wxPython.

This can be used to graphically measure areas on an image for simple image editing operations such as cropping.

Running the demo

The usage example below can be run by running the main file. In a command window run the command

python RectangleSelectorPanel.py

Usage example

Create an panel with an initial image

fr = wx.Frame(None, title='test')
panel = RectangleSelectImagePanel(fr, 'images/Lenna.png')

The initial image is optional. The image can be changed by using the setImage method

panel.setImage('images/Lenna.png')

When the mouse is clicked and held over the image a dotted rectangle appears Image

When the user lets go of the mouse the rectangle turns solid. Image

The origin, width and height of the rectangle are then able to be read. These values are always in pixels and are relative to the original image. For example if a 512x512 image is loaded and the panel is stretched to display the image at 1024x1024, selecting the entire image will still give a result of (0,0) for the origin and (512, 512) for the width and height respectivly.

Dependancies

This module depends on

About

Select an area on an image using a click and drag rectangle in wxPython

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages