title: PySDL2: Renderer or Window Surface for handling colors and text?
body: <p>My question concerns the <code>sdl2.ext.Renderer</code> mainly, and has to do with a problem I've encountered when trying to render sprites on a <code>sdl2.ext.Window</code> surface. </p>
  
  <p>So right now, for coloring my background on an SDL2 Window, I make the following call: </p>
  
  <pre><code>White = sdl2.ext.Color(255,255,255)
  
      class Background(sdl2.ext.SoftwareSpriteRenderSystem):
          def __init__(self,window):
              super(Background,self).__init__(window)
              sdl2.ext.fill(self.surface,White)
  </code></pre>
  
  <p>This colors the surface of the Window with a white background. However, I also want to display text on the screen. This is done by creating a <code>TextureSprite</code> using the <code>from_text</code> method of the <code>sdl2.ext.SpriteFactory</code> class as follows:</p>
  
  <pre><code>Renderer = sdl2.ext.Renderer(W) # Creating Renderer
  
  ManagerFont = sdl2.ext.FontManager(font_path = "OpenSans.ttf", size = 14) # Creating Font Manager
  
  Factory = sdl2.ext.SpriteFactory(renderer=Renderer) # Creating Sprite Factory
  
  Text = Factory.from_text("Unisung Softworks",fontmanager=ManagerFont) # Creating TextureSprite from Text
  
  Renderer.copy(Text, dstrect= (0,0,Text.size[0],Text.size[1])) # Resizing the Texture to fit the text dimensions when rendered
  </code></pre>
  
  <p>The problem occurs when the event loop is run.</p>
  
  <pre><code> running = True
      while running:
          events = sdl2.ext.get_events()
          for event in events:
              if event.type == sdl2.SDL_QUIT:
                  running = False
                  break
              if event.type == sdl2.SDL_MOUSEBUTTONDOWN:
                  pass
  
          Renderer.copy(Text, dstrect= (0,0,Text.size[0],Text.size[1]))
          Renderer.present() # Problem 1
          W.refresh() # Problem 2
      return 0
  </code></pre>
  
  <p><a href="http://pastebin.com/GXLyDfdm" rel="nofollow"><strong>Full Example Paste</strong></a></p>
  
  <p>When both Renderer.present() and W.refresh() are called, I get a flickering effect from the screen. <strong>This seems to be because the Renderer overwrites the White colored Window surface, which then gets colored over again by the Window.refresh() call.</strong> This then repeats, resulting in a flickering mess.</p>
  
  <p>I would like to know what I can do to solve this problem? Should I even be using both Window.refresh() and the Renderer at the same time? Is there a way to let one render the other? (Renderer renders background for example). If anyone can help me out, that would be great. </p>