Fix Bugs in a tkinter Project
That’s enough theory—time to get rid of the bugs in our rock-paper-scissors game! When finished, we’ll be able to play against artificial intelligence and see if computers can outsmart the human brain! 😝
In this screencast, we eliminated the errors caught in the exceptions. First, we imported the functions Label()
and Button()
and the variables E
and W
from Tkinter
.
Then we also fixed the class errors by adding the missing self
parameter and writing the constructor function correctly.
There was one remaining error to do with the Button
function. We corrected this by making it the same as in other parts of the program. After all these changes, the program now works properly!
Over to You!
Our program works! Well… almost. There’s just one last bug that I’ve left for you to figure out. You’re on your own for this one! 😉 Here’s the code for the chapter in the GitHub repository.
Let’s Recap!
In this section, we debugged the project by:
Importing the missing modules.
Using objects and methods correctly.
Resolving the logic errors in the program.
Now let’s do the same with our web application! When you’re ready, join me in the next chapter!