Question

For example, if I draw this circle

Circle

is clearly imprecise and ugly. Is there any way to adjust the sensitivity of the draw?

edit:

I can summarize to:

self.da = wx.Panel(self, -1, size=(-1, 800))
self.da.Bind(wx.EVT_PAINT, self.paint)

self._buffer = wx.EmptyBitmap(500,500) # creating empty buffer
dc = wx.MemoryDC(self._buffer)  # to handle the buffer
dc.SetBackground( wx.Brush("White") )  # setting background
dc.DrawCircle(50,40,100)  #drawing circle


def paint(self, evt):
    dc = wx.BufferedPaintDC(self.da, self._buffer) #on paint event draw this
Was it helpful?

Solution

You can use wx.GCDC because it support anti-aliased drawing

Try this:

buffer = wx.EmptyBitmap(500,500) # creating empty buffer
dc = wx.MemoryDC(buffer)  # to handle the buffer
dc = wx.GCDC(dc)

dc.SetBackground( wx.Brush("White") )  # setting background
dc.DrawCircle(50,40,100)  #drawing circle
dc.DrawCircle(200,200,100)  #drawing circle

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top