Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why wxwidgets draw loosely the circles or rounded polygons?

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
like image 265
user1629569 Avatar asked Mar 20 '23 14:03

user1629569


1 Answers

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

like image 66
Jerry_Y Avatar answered Apr 25 '23 18:04

Jerry_Y