File: PaintPanel

package info (click to toggle)
python-pyo 1.0.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 52,332 kB
  • sloc: python: 135,133; ansic: 127,822; javascript: 16,116; sh: 395; makefile: 388; cpp: 242
file content (1 line) | stat: -rw-r--r-- 905 bytes parent folder | download | duplicates (9)
1
snippet = {'shortcut': u'Shift-Alt-6', 'value': u'class MyPanel(wx.Panel):\n    def __init__(self, parent, id=-1, pos=(25,25), size=(500,400)):\n        wx.Panel.__init__(self, parent, id, pos, size)\n        self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)  \n        self.Bind(wx.EVT_PAINT, self.OnPaint)\n\n    def OnPaint(self, evt):\n        w,h = self.GetSize()\n        dc = wx.AutoBufferedPaintDC(self)\n        dc.SetBrush(wx.Brush("#FFFFFF"))\n        dc.SetPen(wx.Pen("#FFFFFF", width=1))\n        dc.Clear()\n        dc.DrawRectangle(0,0,w,h)\n        for i in range(500):\n            x = (i * 5) % w\n            y = (i * 3) % h\n            col = wx.Colour((i*19)%256, (i*25)%256, (i*39)%256)\n            dc.SetBrush(wx.Brush(col))\n            col = wx.Colour((i*13)%256, (i*15)%256, (i*19)%256)\n            dc.SetPen(wx.Pen(col, width=1))\n            dc.DrawCircle(x, y, radius=(i+2)%9)\n'}