Select that game to see a screen similar to
Figure 4-3.
CHAPTER 4 n CREATING REPORTS ON THE DESKTOP 67
Figure 4-3. Player graph displayed by the GUI
Let??™s take a look at the important parts of the script.
Dissecting the Code
The first part of Listing 4-3 sets up the connection to MySQL, creates the various models,
and so forth??”nothing new there.
The bulk of the program is controlled by one class, TransmegtechGraphWindow, which is
divided into two parts: update_display and initialize methods. update_display creates a
graph for the selected player, writes it to a file, and then displays it in your application.
Much of this graphing code is the same as the code from Listing 3-4 in Chapter 3. The
initialize method creates a window and the user interface elements required: the dropdown
lists to select the game and player to graph, the labels for those two drop-down
lists, and the large display area that will be used to view the graph.
Whenever either of the drop-down entries is changed??”that is, when the user selects
a new game or a new player to graph??”the update_display method will be called again.
Pages:
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115