thelost
thelost

Reputation: 705

Canvas Selection Tool? wxpython

Is there a way to make a canvas selection tool in wxpython?

LEFT BUTTON PRESSED: When the left button is pressed start drawing rectangle and update it until the user releases the left button.

LEFT BUTTON RELEASED: Finish drawing rectangle

It is something similar that you would see in a paint program.

enter image description here

If possible please provide an example. Thanks.

Upvotes: 0

Views: 704

Answers (3)

Mike Driscoll
Mike Driscoll

Reputation: 33091

The Whyteboard application has a selection tool that you could use for inspiration. You can get it here: http://whyteboard.org/ It's written in wxPython. By the way, the wxPython mailing list is a great place to ask questions too.

Upvotes: 1

Toni Ruža
Toni Ruža

Reputation: 7512

You could try to do it with wx.Overlay

Upvotes: 1

joaquin
joaquin

Reputation: 85653

You have an example of a drawing canvas in the source code downloads from wxPython in Action. This is a canvas for freehand sketching. You can start from there to expand its functionality.

The simpler example is example1.py from Chapter-06 folder. There are several other examples in the same chapter with increasing functionality.

For an example of a drawing tool selector and how to move and modify the objects selected and set in a frame I would recommend to look at the code of the wxglade GUI designer.

Upvotes: 1

Related Questions