title: Pygame - Display variable on display window
body: <p>I'm using Pygame and have figured out how to display text on the screen. But how would I get this to work for a variable, so instead of it displaying "Hello" it'll display my variable. For example, say I have a variable and I'd like to display it/any changes made to it on the display panel. So if my variable was 1, and if 1 was added to it, I'd like to display the changed variable.</p>
  
  <pre><code>#Dice random number generation
  diceRoll = random.randrange(0, 5)
  
  #Text through GUI
  myFont = pygame.font.SysFont("Times New Roman", 18)
  
  randNumLabel = myFont.render("You have rolled:", 1, black)
  diceDisplay = myFont.render(diceRoll, 1, black)
  
  screen.blit(randNumLabel, (520, 20))
  screen.blit(diceDisplay, (520, 30))
  
  pygame.display.flip()
  </code></pre>