[wxpython-users] Advice on drawing shapes

Stewart McLay sam at roe.ac.uk
Tue Apr 1 07:39:06 PDT 2008


Thanks for all of the replies. I think I will look more closely at the 
pySketch example as that is closest to what I would like to do. Also, I 
think it just uses the standard WxPython library without any additional 
source code which makes things simpler from a maintenance point of view.

Cheers,

Stewart

Robin Dunn wrote:
> Stewart McLay wrote:
>> Hello Everyone,
>>
>> I am thinking about creating a window with a wx.GraphicsContext. On 
>> that window I want to be able to draw rectangle by left clicking the 
>> mouse whilst on the window and and dragging the mouse. I want to be 
>> able to see the rectangle grow from the origin of the click and remain 
>> once the mouse button has been released. I think this looks achievable 
>> in wxPython but I haven't seen any good examples in the demo 
>> application that demonstrate how to do this kind of thing. Is this 
>> possible to do in wxPython? and does anyone know where a good example 
>> might be found?
> 
> And if FloatCanvas or OGL are not what you are looking for, it's not 
> hard to do it yourself.  Just catch the mouse events and draw as needed. 
>  It's not using wx.GraphicsContext, but there is an example of doing 
> things like this with wx.DC in samples/pySketch.
> 
> 
> 


More information about the wxpython-users mailing list