def toggle_paused(self):
     self.paused = not self.paused
     if self.paused:
         sound.pause_music()
     else:
         sound.resume_music()
     sound.play("pause")
 def loseGame():
     delay = 5
     changes_per_frame = 5
     changes_this_frame = 0
     for i in range(delay):
         yield
     sound.pause_music()
     sound.play("game_lost")
     for j in range(self.state.rows - self.state.obstructed_rows):
         for i in range(self.state.cols):
             self.field.set(Point(i,j), "black")
             changes_this_frame += 1
             if changes_this_frame == changes_per_frame:
                 yield
                 changes_this_frame = 0
     for i in range(30):
         yield
     self.replace(HighScoreScreen, self.state.score)