Tutoring 2
To complete this task you are required to produce a Python program with capabilities equivalent to that above, using the provided stay_home_shopping.py template file as your starting point. In addition you must provide two previously-downloaded web documents as your source of “old stock” products and (at least) one GIF image to display as your shop’s logo in the GUI.
Your complete solution must support at least the following features. Marks available are as shown.
- An intuitive Graphical User Interface (4%). Your application must provide an attractive, easy-to-use GUI. You have a free choice of which Tkinter widgets to do the job, as long as they are effective and clear for the user. This interface must have the following features:
- An image which serves as the shop’s logo. Note that most Tkinter implementations only support GIF images. The image file should be included in the same folder as your Python application.
- A heading which names your online shop. This can be part of the above image or a separate widget. Either way, you must name your shop in the Tkinter window’s title.
- Widgets that allow the user to select from four categories of products for sale and see the products available in each category. It must be possible to distinguish the two unchanging “old stock” categories from the two current “live” ones.
- A widget or widgets that allow the user to export an HTML document containing images of the products in the currently-chosen category.
- Widgets that allow the user to add all products in the currently-chosen category to their shopping cart and see the shopping cart’s contents. Users must not be given the ability to choose individual products from within a category.
Note that this criterion concerns the front-end GUI elements only. The functionality of your program is covered in the following criteria.
- Displaying products and their prices in the GUI (6%). Your program must give the user the ability to select and view product categories in the GUI, choosing from two unchanging categories and two live ones. The first five products from the chosen category’s source web document must be listed, including their name and price. The URL of the source web site must be shown and it must be explicitly stated which category has currently been selected. The product data must be extracted using pattern matching techniques from HTML documents either previously downloaded and stored in local files, for the two static categories, or downloaded from the web while the program is running, for the two live categories. In the latter case your program must allow for the possibility that the source web sites have been updated and must be robust to problems accessing the web sites. Product names and prices must align correctly as per the original web site. The names and prices should appear exactly as they do on the original web site, with no unintended HTML mark-ups or odd characters displayed.
- Exporting an HTML document with images of the products (4%). Your program must provide the user the ability to export an HTML document containing images of the five products in the currently-selected category (and no others). The HTML document must contain appropriate titles to identify your online shop and the chosen category, a hyperlink to the source web site and, for each of the five products, its name and image. It must be created as an HTML document in the same folder as your Python program and must be called product_images.html. It must incorporate appropriate HTML markups that make its contents viewable in any standard web browser. The images must all be links to images found online, not to local files, must preserve their original aspect ratio, and must be of a size consistent with that of the rest of the document, regardless of their original dimensions. When viewed the document must have a professional appearance and the product names and photos must align correctly as per the original web document.
- Adding the currently-chosen category to the shopping cart (3%). Your program must provide the user the ability to add all the items from the currently-selected product category to their shopping cart and see the cart’s contents at all times. The user may not choose specific products from the category; all available products must be accepted as a job lot in a single action. Also, users must be limited to adding each category to their shopping cart only once.
- Good Python and HTML code quality and presentation (4%). Your Python program code and the generated HTML code must be presented in a professional manner. See the coding guidelines in the IFB104 Code Presentation Guide (on Blackboard under Assessment) for suggestions on how to achieve this for Python. In particular, each significant code segment must be clearly commented to say what it does, e.g., “Extract the link to the photo”, “Show the price”, etc.
- Extra feature (4%). Part B of this Tutoring will require you to make a ‘last-minute extension’ to your solution. The instructions for Part B will not be released until just before the final deadline for Tutoring 2.
You can add other features if you wish, as long as you meet these basic requirements. You must complete the task using only basic Python features and the modules already imported into the provided template. You may not use any Python modules that need to be downloaded and installed separately, such as “Beautiful Soup” or “Pillow”. Only modules that are part of a standard Python 3 installation may be used.