title: Pygame Clearing The Screen
body: <p>I have made a class and in the draw function, I draw a textarea, some static text, and color the screen. The draw function is in a while loop. I want the whole pygame screen to clear except for the input box and I want the screen to change color. How do I do that? My code is below:</p>
  
  <p><code>import pygame</code></p>
  
  <p><code>from Settings import *</code></p>
  
  <p><code>from TextInput import *</code></p>
  
  <p><code>from Draw import *</code></p>
  
  <p>pygame.init()
  pygame.font.init()</p>
  
  <p>class Txt():</p>
  
  <pre><code>def __init__(self):
  
      self.running = True
  
      pygame.display.set_caption('TruTxt')
  
      self.input_box = InputBox(50, 550, 1200, 300)
  
  def run(self):
  
      while self.running:
  
          self.events()
  
          self.draw()
  
  def events(self):
  
      events = pygame.event.get()
  
      for event in events:
  
          if event.type == pygame.QUIT:
  
              self.running = False
  
          if event.type == pygame.K_RETURN:
  
              pass
  
          self.input_box.handle_event(event)
  
  def draw(self):
  
      start()
  
      self.input_box.draw(screen)
  
      pygame.display.flip()
  </code></pre>
  
  <p>t = Txt()</p>
  
  <p>while t.running:</p>
  
  <pre><code>t.run()
  </code></pre>
  
  <p>pygame.quit()</p>
  
  <p>def start():  </p>
  
  <pre><code>screen.fill((0, 0, 255))
  
  myfont = pygame.font.SysFont('Comic Sans MS', 64, True)
  displaytxt = myfont.render(hellotxt , True, (255, 255, 255))
  screen.blit(displaytxt, (300, 30))
  
  myfont = pygame.font.SysFont('Comic Sans MS', 24)
  displaytxt = myfont.render(wlcmtxt , True, (255, 215, 0))        
  screen.blit(displaytxt, (30, 200))
  
  myfont = pygame.font.SysFont('Comic Sans MS', 39, True)
  displaytxt = myfont.render(strttxt , True, (255, 255, 255))        
  screen.blit(displaytxt, (28, 370))
  
  myfont = pygame.font.SysFont('Comic Sans MS', 28, False, True)
  displaytxt = myfont.render(destxt , True, (255, 215, 0))        
  screen.blit(displaytxt, (165, 450))`
  </code></pre>