1

I've been making a small game for a homework assignment using Pygame with Livewires. I've been trying to debug it, but to no success; I can't get a look at the variables I want to look at before the main loop is executed. Though I can press F10 to skip over the main loop, that just stops the Autos and Watches window from working; apparently they can only records vars when the game is paused by the debugger.

Is there a way for me to use the debugger to look at the vars in runtime? Because no matter what I do while the debugger is paused, I can't look at the data inside the game objects I want to take a look in

Tespy
  • 971
  • 2
  • 9
  • 18
  • could you share a screen shot about the result in your side? Do you really add a breakpoint in your app? Is the breakpoint hit? What I know is that if the breakpoint was hit, to view a value using DataTips, simply hover the mouse over any variable in the editor. Or you could use python debug interactive whenever the debugger is broken. – Jack Zhai Sep 19 '16 at 06:09
  • What result are you talking about? And yes, I added a breakpoint, and it was hit. Though, I tried your suggestion about hovering over the mouse, and after having the game go through enough frames, I managed to see the game objects' values. Then, I unpaused the debugger, then repaused it with Break All. After pressing F10 a few times, I noticed I could see the values of my objects (though the interface wasnt intuitive). So, I guess my problem is fixed. Thanks :) – Tespy Sep 19 '16 at 21:41

1 Answers1

0

Thanks to Jack Zhai's suggestion, I figured it out.

  1. When the breakpoint is hit, unpause the debugger (shortcut: F5)

  2. Play to the point in the game you want to debug.

  3. Repause the debugger using Break All (shortcut: Ctrl-Alt-Break)

  4. Press F10 a few times; this makes it go a few more steps in the main livewires loop.

  5. In the autos window, there is an entry that contains the a list of the game's objects. Look through it, until you find the one(s) you're looking for. In my case, the list of the objects was self._objects. The object I was looking for was the second, which in other words, was self._objects[1].

  6. The dropdown arrows of the object(s) you're looking for show the object's members. If you want to look at the object's properties in a less cumbersome way, use the Interactive Debugger to assign that object to a variable. That way, you can look at its values through typing objectNameHere.objectValueHere into the interactive debug console.

In my case, I had to type in player = self._objects[1] to get it assigned, then could see the player's x position by then entering player.x into the debug console.

--

I know this answer might only work for my specific problem, so if anyone else has a better one, please post it for others' sake.

Tespy
  • 971
  • 2
  • 9
  • 18
  • Glad to know that you have resolved this issue, thanks for your sharing, please mark your solution as the answer:) – Jack Zhai Sep 21 '16 at 03:17
  • Sure. If someone else posts a better answer, I'll be sure to mark theirs as the best one :) – Tespy Sep 21 '16 at 15:43