title: Getting dict value from for loop in Python
body: <p>tl;dr:</p>
  
  <p>I have a Scene class and scene01 and scene02, both instances of Scene. scene01 have a button.
  This button is inside a dictionary named buttons, e.g. {button_next : scene02}</p>
  
  <p>The for loop goes like this:</p>
  
  <pre><code>def loop(self):                                                         #SCENE LOOP
          while True:
              for event in pg.event.get():
                  if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
                      pg.quit()
                      sys.exit()
                      for k, v in self.buttons.items():
                          if 'click' in k.handleEvent(event):
                              self.goto(v)
              pg.display.update()
  </code></pre>
  
  <p>'click' in k.handleEvent(event) is from the PygButton widget. It return when there is a mouse click over the button. Button being an instance of the PygButton() class.</p>
  
  <p>goto() checks if the value from the key-value pair is 'quit' (calling the app to quit) or an instance of Scene, e.g. scene01, calling the scene loop, drawing the new screen and new buttons.</p>
  
  <p>The app starts, the first scene is there as is its buttons, but there is no response from a click on them. Escape quits the app so the loop is working. And exiting the app through the escape doesn't return anything from the IDLE.</p>
  
  <p>I think the problem is on the goto() method and/or how I'm calling the value from the dictionary, but I'm stuck.</p>
  
  <p>Help?</p>