Algo mas o menos así?
Código Python:
Ver originalimport wx
class DrawPanel(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="Draw on Panel")
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_MOTION, self.OnClick)
self.lastPos = None
def OnPaint(self, event=None):
self.dc = wx.PaintDC(self)
def OnClick(self, event):
pos = event.GetPositionTuple()
if(not event.Moving()):
if(self.lastPos is None):
self.lastPos = pos
self.dc.DrawLine(*(pos + self.lastPos))
self.lastPos = pos
else:
self.lastPos = pos
app = wx.App(False)
frame = DrawPanel()
frame.Show()
app.MainLoop()
Todavía falta mejorarlo mucho, pero esto se le deja como ejercicio al lector.