title: How to (properly) synchronise self.Refresh() with the screen refresh to avoid blinking drawing?
body: <p>I am trying to animate a 2d Object (drawn as a path), therefore it needs to be redrawn. What is the best way to redraw it without having a blinking object?</p>
  
  <p>After redrawing it with <code>self.Refresh()</code> when the onIdle-Event is called, then I used a timer with a fixed time to call <code>self.Refresh()</code>, which works way better. But still I have the problem of a blinking object.</p>
  
  <pre class="lang-py prettyprint-override"><code>import wx
  import math
  import time
  
  class ObjectDrawer(wx.Frame):
  
      def __init__(self, *args, **kw):
          # Initialize vars
          self.dc = None
          self.gc = None
          self.lastTime = time.time()
          super(ObjectDrawer, self).__init__(*args, **kw)
          self.InitUI()
  
      def InitUI(self):
          self.timer = wx.Timer(self)
          # Initialize the GUI
          self.Bind(wx.EVT_PAINT, self.OnPaint)
          self.Bind(wx.EVT_TIMER, self.evt_timer)
          self.ShowFullScreen(True)
          self.SetBackgroundColour('white')
  
      def evt_timer(self, event):
          self.Refresh()
  
      def drawObjects(self):
          path = self.gc.CreatePath()
          #Add Something to the path e.g. a circle
          path.AddCircle(100,100,50)
          self.gc.StrokePath(path)
          path = None
  
      def OnPaint(self, e):
          dc = wx.PaintDC(self)
          self.gc = wx.GraphicsContext.Create(dc)
          self.gc.SetPen(wx.Pen('#e8b100', 5, wx.LONG_DASH))
          self.drawObjects()
          self.timer.Start(1000/60)
  
  
  app = wx.App()
  window = ObjectDrawer(None)
  window.Show()
  app.MainLoop()
  </code></pre>