Today I’m going to teach you how to use Idles Debugger! First you have to open your python script next to open the debugger. Go to the shell window. Click the Tab Debug and then click debugger. Let’s go over the layout of the debug panel in the top left. We have the buttons, go stepped over out and quit The go. Button runs the program until it hits a breakpoint or the end of the program. The step button advances the program by one line, the over button will execute all lines within a function call. If you are currently inside a function. The out button will execute all the lines until the end of that function Finally quit stops the program, but it does not exit idle or the debugger. Next to those buttons, we have the options stack, local source and global stack shows you the main box. With the current line of code locals shows the list of local variables, global shows a list of global variables and source shows the current line in the code editor. Finally, I want to talk about Breakpoints. A breakpoint is a marker that tells the debugger when you want to stop automatic execution and start stepping through code manually to add a breakpoint. Go into the code editor and Right-click align, click set Breakpoint. If you want to remove a breakpoint, right, Click a break point and click clear Break point break points are highlighted yellow. Now I’ll go on to a demonstration. Alright, so I have my debug control panel here open, and I have this all four. The stack source locals and Globals all selected this. Here’s the stack. This here’s the locals this. Here’s the Globals and the source is the source code with the debug control panel open. I can run the program and will start debugging here. This highlighted line is the next line that will be executed. It has not been executed yet, so without break points. If I click go, it’ll just go all the way to the end of the program and well. Stop, so if I run this again if I don’t want to go until the end, I’ll use the step function to go line by line so here. I want you to to take a look at the Globals you’ll see at the bottom. The X, The X variable and Y variable will appear. So when we execute this first line, X 5 will be added to the bottom of the Globals. Then I step over this next one now. The y is added now. This next print function, this printf. This print is a function, So if I step into it, it will open up a new script and it will go through all of the different lines of code that require is required to actually run print. So I’ll show that now, so if I hit step, it just opens up another program and I can step through all of the pieces of print, which is not very useful. So if you’re in a function like this, you can click out and it will go to the next line that is outside of the function. However, if you don’t, however, you, you want to use over beforehand, so if you’re if the line says print and you have not gone in to this, you haven’t actually gone into the function you can click over and it will go over the print function entirely. You won’t have this open which I’ll show on the next print one, but here I can click out and we’ll just go to the next. There’s a couple more functions, but it will go to the next function and now I’m at the for loop so here I’m going to step into this first time, and now it says print now. I don’t want to go into this print again, so I can just click over and it will skip the next line and it’s still printed, but it just didn’t go through each step now. I can keep going doing this for a while. Um, you know, we can go over again. Step and step over and whatever just over, just skip through all of this until we get out of this loop here we go now we’re on this last line and then here again I’m going to hit step over and now the fun. The program ended now real quick. I just want to show what happens when you click the quit button If I run it again and now we’re debugging. If I just hit quit, it just ends the process and it keeps open the debug idle. Shell and everything. It just stops running the program now. I want to show the break points, So let’s say I want to add a break point. I want the entire program to run up until I hit this Z. Equals I plus 2 line. I can, I can right, click and hit set break point, which will highlight that line then. If I run the program, I can click go, which will now run the entire program until it hits that break point, so I can hit go and all it already went to I X and Y, and it already printed. So now we’re at this point, it says it so here, it says line eight Z equals. I plus two now I can step and it will go again so we can hit. Go and go and we can just keep it doing this. And now since we’re at the last one, it will just print. Oh, you don’t want to do that there? We go now since we just, that’s pretty much all. I wanted to go over with debugger. That’s pretty much! All you need to know, so have fun.