## page was renamed from How to draw a rounded rectangle (Phoenix) = How to create a rounded rectangle (Phoenix) = '''Keywords :''' RoundedRectangle, Drawing, PaintDC, GCDC. <<TableOfContents>> -------- = Demonstrating : = __'''''Tested''' py3.x, wx4.x and Win10. ''__ Are you ready to use some samples ? ;) Test, modify, correct, complete, improve and share your discoveries ! (!) -------- == First example == {{attachment:img_sample_one.png}} {{{#!python # sample_one.py import wx # class MyPanel # class MyFrame # class MyApp #--------------------------------------------------------------------------- class MyPanel(wx.Panel): def __init__(self, *args, **kwargs): wx.Panel.__init__(self, *args, **kwargs) self.Bind(wx.EVT_PAINT, self.OnPaint) #----------------------------------------------------------------------- def OnPaint(self, event): """ ... """ pdc = wx.PaintDC(self) gc = wx.GCDC(pdc) gc.Clear() gc.SetPen(wx.Pen("black", 2)) gc.SetBrush(wx.YELLOW_BRUSH) x = 100 y = 30 w = 100 h = 50 for radius in [3, 6, 9, 12, 15, 18, 21]: # x, y , width, height, radius gc.DrawRoundedRectangle(x, y, w, h, radius) gc.DrawText(str(radius), int(x+w+10), int(y+h/2)) y+=100 #--------------------------------------------------------------------------- class MyFrame(wx.Frame): def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) #------------ frameicon = wx.Icon("icon_wxWidgets.ico") self.SetIcon(frameicon) #------------ self.Panel = MyPanel(self) #--------------------------------------------------------------------------- class MyApp(wx.App): """ ... """ def OnInit(self): #------------ frame = MyFrame(None, title="Sample_one", size=(320, 750)) self.SetTopWindow(frame) frame.Show(True) return True #--------------------------------------------------------------------------- def main(): app = MyApp(False) app.MainLoop() #--------------------------------------------------------------------------- if __name__ == "__main__" : main() }}} -------- = Download source = [[attachment:source.zip]] -------- = Additional Information = '''Link :''' http://zetcode.com/wxpython/gdi/ - - - - - https://wiki.wxpython.org/TitleIndex https://docs.wxpython.org/ -------- = Thanks to = Chris Barker, the wxPython community... -------- = About this page = Date(d/m/y) Person (bot) Comments : 14/12/19 - Ecco (Created page for wxPython Phoenix). -------- = Comments = - blah, blah, blah....