title: Internal leaderboard for Python game
body: <p>First of all, I'm still relatively new to programming, so please go easy on me.</p>
  
  <p>I'm programming an arcade-like game with Python2.7 and I want to implement a leaderboard that can store, say, 10 pairs of username and score achieved. To give you an idea, it should look more or less like this:</p>
  
  <pre><code>1. AAA 100
  2. BBB 10
  3. CCC 1
  </code></pre>
  
  <p>...And so on. This way, it should be able to keep track of 10 scores.</p>
  
  <p>When a player finishes the game and tops a score on the leaderboard, he should be prompted to enter a name with a maximum of 15 characters and the score should be saved. Furthermore, the code for the game should allow the player to look at the leaderboard <strong>from the start menu</strong>, i.e. the highscores should be possible to visualize upon clicking on "Leaderboard".</p>
  
  <p>I've tried searching for a way to do this, but unfortunately the results either covered online leaderboards, only saved the highest ever reached score or were too complicated for me as a programming beginner to grasp. I also can't be sure whether any of those possiblities would allow for reading of the leaderboard in the game itself.</p>
  
  <p>I'd much appreciate if someone could lend me a hand with this issue.</p>
  
  <p>(In case I wasn't clear enough (I was tired when writing this), my only problem is opening and reading from/writing to a different file containing the leaderboard and displaying it in the game. I do not, however, want it to appear in the Shell.)</p>
  
  <p>Edit:</p>
  
  <pre><code>pygame.font.init()
  font = pygame.font.Font(None, 30)
  readfile = open("leaderboard.txt", "r")
  text = font.render(readfile, True, (27,100,225))
  textRect = text.get_rect()
  textRect.centerx = screen.get_rect().centerx
  textRect.centery = screen.get_rect().centery
  screen.blit(text, textRect)
  </code></pre>
  
  <p>As suggested I tried the render command, and so far I've come up with this, but I get an error message:</p>
  
  <pre><code>Traceback (most recent call last):
  File "L:\game.py", line 97, in &lt;module&gt;
  text = font.render(open("leaderboard.txt", "r"), True, (27,100,225))
  TypeError: text must be a string or unicode
  </code></pre>