title: How to load an image in pygame?
body: <p>So I'm a new programmer 2 weeks of learning. I was wondering on how to load an image correctly using Pygame 1.9.6. I'm trying to roll a dice and whatever it rolls loads the correct image. But, I need to know how to load an image first.</p>
  <p>Now this is all what I've come up with so far:</p>
  <pre><code>import pygame as p
  
  
  WIDTH = HEIGHT = 250
  DIMENSION = 2
  SQ_SIZE = HEIGHT // DIMENSION
  IMAGES = {}
  
  
  class DiceState:
     def __int__(self):
         self.Dice = ['d1', 'd2', 'd3', 'd4', 'd5', 'd6']
  
  
  def drawBackground(screen):
      colors = [p.Color(&quot;black&quot;)]
      for d in range(DIMENSION):
          color = colors
          p.draw.rect(screen, color, p.Rect(SQ_SIZE, SQ_SIZE))
  
  
  def loadImages():
      dice_sides = ['d1', 'd2', 'd3', 'd4', 'd5', 'd6']
      for dice_side in dice_sides:
          IMAGES[dice_side] = p.transform.scale(p.image.load(&quot;images/&quot; + dice_side + &quot;.png&quot;), SQ_SIZE)
  
  
  def main():
      p.init()
      screen = p.display.set_mode((WIDTH, HEIGHT))
      screen.fill(p.Color(&quot;white&quot;))
      ds = DiceState
      loadImages()
      running = True
  
  
  if __name__ == &quot;__main__&quot;:
      main()
  </code></pre>
  <p>d1 means dice 1 for number 1. d2 = number 2</p>
  <p>What I've tried is that it's my first time attempting this so I have no idea what to do. I know I shouldn't come on this site and pester you all to fix my issues. But all I want is help. I want to learn like you all too. So please help me if you can and want.</p>