April 2018
Beginner
340 pages
7h 54m
English
First, copy over the Card class from the code you wrote for Chapter 2, Back to the Command Line - Basic Blackjack. There are no changes to the existing methods in this class, but we need to add one more for our graphical implementation:
@classmethoddef get_back_file(cls): cls.back = tk.PhotoImage(file=assets_folder + "/back.png") return cls.back
This new method will use a decorator to make it into a class method. A class method functions much like a regular method (or function), except that it does not require an instance of the class to work.
For this reason, we name the first variable cls instead of self. Python will automatically pass a reference to the class itself to a class method, meaning just as is the case with ...