Hi I am drawing a circle using wxpython for a project.Please look through the code and tell me what I am doing wrong it's not even showing any error but not drawing the circle either. I am just getting a blank window.
import wx
class SketchFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1, "Sketch Frame",size=(350,350))
self.sketch = SketchWindow(self, -1)
class SketchWindow(wx.Window):
def __init__ (self, parent,ID):
wx.Window.__init__(self, parent, ID)
self.panel =wx.Panel(self, size= (350,350))
self.InitBuffer()
def InitBuffer(self):
size=self.GetClientSize()
self.Buffer=wx.EmptyBitmap(size.width,size.height)
dc=wx.BufferedDC(None,self.Buffer)
dc.SetBackground(wx.Brush(self.GetBackgroundColour()))
dc.Clear()
self.Drawcircle(dc)
self.reInitBuffer=False
def Drawcircle(self,dc):
pen=wx.Pen('blue',4)
dc.SetPen(pen)
dc.DrawCircle(100,100,50)
def OnPaint(self, event):
dc = wx.BufferedPaintDC(self, self.buffer)
if __name__=='__main__':
app=wx.PySimpleApp()
frame=SketchFrame(None)
frame.Show(True)
app.MainLoop()
Thanks