Assignment 6: Baseball GUI Solution

$30.00

Description

Your task is to build a complete functioning GUI shown below:

Menus

Frame1 (labels and entries)

Frame2 (label and entry)

Frame3 (labels)

Frame4 (text)

Frame5 (buttons)

Building GUI:

  1. Place Frame1 into the window and place seven labels and seven entry widgets into this frame as show below:

  1. Place Frame2 into the window and place one label and one entry widget in this frame as follows:

  1. Place Frame3 into the window and place labels into this frame as follows:

4. Place Frame4 into the window and place a text widget and scroll bar into this frame as follows:

5. Place Frame5 into the window and place five buttons into this frame as follows:

  1. Now implement the function associated with the first button (Compute a Player’s Statistics) to get the data placed in the entry widgets in Frame1, associated with a player’s statistics as follows.

When this button is clicked the player’s statistics are displayed in the text widget (hint: create a PlayersYear object with this data and call the __str__() function in the PlayersYear class to insert the statistics in the text widget, shown below).

  1. Now implement the function associated with the second button (Process Player File) to open the file in the entry widget in Frame2 and read all players in the file.

When this button is clicked all outputs are inserted in the text widget as follows:

Hint: use the function you wrote in assignment 4 to open the file and read the baseball statistics (note this function returns a list of PlayersYear objects). Now use the __str__() function to process each PlayersYear object to produce above display (you may have to adjust the width of the labels in the Frame3 so the output lines up with the labels).

8. a) Next implement the function associated with the last button (Quit Baseball Analyzer) to quit the program.

  1. Similarly, implement the function associated with the button (Clear Player’s Statistics). When clicked this button cause all entry widgets to be reset to the empty string ‘’ or to the integer 0 and the text widget to be reset to the empty string ‘’.

9. Next create a menu (Sort) and submenus, as follows:

a) When choosing “Sort on home runs”, the information placed in the text widget is as follows:

Note that there is a blank line between outputs in the text widget!

b) When choosing “Sort on at bats”, the information placed in the text widget is as follows:

c) When choosing “Sort on slugging percentage”, the information placed in the text widget is as follows:

d) When choosing “Sort on batting average”, the information placed in the text widget is as follows:

  1. Next, implement the function associated with the button “Save Log” to save all the text in the text widget to a file called session_log.txt.

11. Finally, create a second menu called “About Analyzer” with one submenu “Help” as follows:

Implement the function associated with the “Help” menu choice to display a messagebox like the one below with information about how this GUI works: