A GUI application which assists indesisive users with selecting their diner plans. After selecting whether or not the user would like to have take out or to dine in, they may choose to either generate a single, random restaurant; 3 random restaurants; or view all restaurants choices within their dining preference. The list of restaurants are hard coded into the Restaurants object.
- Language:
- Python 3
- Frameworks:
- unittest
- Libraries:
- tkinter
- random
- IDE:
- (preferred) Visual Studio Code
-
- This program was developed and tested with Visual Studio Code.
- Run main.py from any IDE that supports Python.
-
- Traverse to the dining_dilemma directory
- Command:
python src/main.py
-
- Traverse to the dining_dilemma directory
- Command:
python -m unittest -v tests.test_restaurants
-v
(verbose) flag is optional. It will provide a more detailed output.
-
The user makes a choice between dine-in and take-out restaurants.
The user's selection will be stored in a global variable (within main.py). This value will later be used as a parameter, when instantiating a Restaurants object. The parameter is the determiner to which list the user will have access to. Both lists contain a nested dictionary, which stores the establishment's name and the reason (the food) the user likes to get there. The dine-in list contains information regarding the establishments the user enjoys going to when she wants to eat out. The take-out list contains information regarding the establishments the user enjoys getting food from, to take back home to eat; this includes restaurants and fast food.
After either button is clicked, the application will proceed to the next frame, the Option Selector frame.
-
The user makes a choice between generating a single random restaurant, generating a list (of 3) random restaurants, or viewing all the restaurants in the selected list., and a button to go back to Order Method
After a Restaurants object has been instantiated, the choice selected by the user will be call the appropriate function. The Random Restaurant button will call the generate_random_list function from the Restaurants object. This function call is paramterless, therefore it will return a list of default length 1. The application will then proceed to the Random Restaurant frame. The Random List button will also call the generate_random_list function from the Restaurants object. However, it will pass LIST_SIZE as a parameter (declared to 3); therefore, it will return a list of length 3. The application will then proceed to the Random List frame. The View All Options button will call the get_restaurants_list function from the Restaurants object. This function will return a list of all of the restaurant's names for the selected list. The application will proceed to the View All frame.
-
Displays the randomly selected restaurant, the description of what the user likes to get at the establishment, a button to regenerate the response, and a button to go back to Option Selection.
The randomly selected index that was returned by the Restaurants object is split amongst two labels. Both labels are concatenated with Strings to better understand the texts. The first label asks the user if they are in the mood for, the food that they like to get at this establishment. The second label then names the restaurant. The Regen button will select a random index again from the instantiated Restaurants object. Note: that it may select the same index as before.
-
Displays the name of the 3 randomly selected restaurants, a button to regenerate the response, and a button to go back to the Option Selection.
The 3 randomly selected indices that where returned by the Restaurants object is split into 3 labels, concatenated to give them an ordered precedence. The labels only include the name of the restaurants'. The Regen button will select 3 random indices again from the instantiated Restaurants object. Note: that it may select the same indices, in the same order as before.
-
Displays a list of the name of all the restaurants, includes a scroll wheel if the list grows to large, and a button to go back to the Option Selection.
The list that was returned by the Restaurants object will be iterated through, and populate a list box. The list box will be configured to a vertical scroll bar, so that the user can scroll up and down the list, if it were to grow to large to view all at once.
If I were to improve this code, I would:
- Modulize the GUI code
- Implement a relational database to store the restaurant list
- Add more data (i.e., cusines) with search options for the respective data
- While this would require a database connection, it would remove the block of restaurants list
- Improve the UI by using a different library, framework, or language
- While a massive improvement, also a massive task
- This is my first GUI program so I'm not too disappointed with it