Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create Python GUI for Sales(Money) Register for a clothing company that sells 3

ID: 3751739 • Letter: C

Question

Create Python GUI for Sales(Money) Register for a clothing company that sells 3 kinds of shirts.

Layout of the Sales(Money) Register:

Shirt Code:   (Here is a textbox beside Shirt Code label)
Quantity:      (Here is a textbox beside Quantity label)
   (Here is a Radio button with label “Customer”)    (Here is a Radio button with label “Staff”)
(Here is “Add to purchase” button) (Here is “Delete purchase item” button) (Here is “Confirm purchase” button) (Here is “Clear” button)
(Here is a large textbox with scroll bar, this large textbox will displayed all the information)

The 2 Radio buttons are directly under the textbox with Quantity label.
The 4 buttons are side by side beside each other directly under the 2 Radio buttons.


Shirt information:
First Shirt:         Shirt Code: LS,   Shirt Name: Long Sleeve Shirt ,   Price: $13.99
Second Shirt:    Shirt Code: MS,   Shirt Name: Medium Sleeve Shirt,   Price: $8.99
Third Shirt:        Shirt Code: SS,   Shirt Name: Short Sleeve Shirt, Price: $3.99

The Sales(Money) Register has 2 dictionaries. 1 dictionary to store and keep track of the Shirt information which is Shirt Code, Shirt Name and Price where Shirt Code is the key to get/retrieve the Shirt Name and Price.
Another 1 dictionary store or keep track of the current purchase information for Shirt Code and quantity with Shirt Code as the key to access quantity.

When the Sales(Money) Register begins, only “Add to purchase” button is enabled and the other 3 buttons are disabled.

If there is Shirt added to the current purchase, the “Delete purchase item” button, “Confirm purchase” button will be enabled.

The “Clear” button will only be enabled after the customer or staff clicked on the “Confirm purchase” button. The “Clear” button is to clear all the information in the large textbox with scroll bar to begin a new purchase.

By default, if no value is entered for the Quantity, the Quantity is 1.

The current purchase information is always updated in the large textbox with scroll bar.
The Shirt for the current purchase will be display in alphabetical order.
For instance: Long Sleeve Shirt, then Medium Sleeve Shirt and lastly Short Sleeve Shirt.

If the customer or staff clicked on the “Add to purchase” button without any value being enter for Shirt Code textbox or the value entered is invalid, displayed an error message in the large textbox with scroll bar. Value for Shirt Code must be LS, MS or SS.
Error message: “Invalid Shirt Code! Shirt Code must be LS, MS or SS” .

If the Staff Radio button is selected, the current purchase will have a discount of 30%.
Discounted information will be displayed in the large textbox with scroll as well.

The customer or staff can removed any Shirt in the current purchase by entering the valid Shirt Code and Quantity and clicked on “Delete purchase item” button. The information for the current purchase will then be updated and displayed in the large textbox with scroll bar.
Again, when there is no Shirts in the current purchase, only the “Add to purchase” button is enabled and the other 3 buttons are disabled.

If the customer or staff decide to confirm the purchase by clicking on the “Confirm purchase” button, only the shirts in the current purchase are displayed in the large textbox with scroll bar. The previous shirt information like deleting a shirt information will not be displayed after the “Confirm purchase” button is clicked.
A message “Current purchase is confirmed” is displayed in the large textbox with scroll bar.
And only the “Clear” button is enabled to get ready for the new purchase.
The rest of the buttons are disabled.

If the “Clear” button is clicked, the Sales(Money) will be back to the beginning stage when it is run. For instance, all textbox are empty and cleared, 2 Radio buttons are deselected, only the “Add to purchase” button is enabled, the rest of the buttons are disabled and the large textbox with scroll bar at the bottom is empty as well.


Example of displayed information for  the Sales(Money) Register in the large textbox with scroll bar for staff:

Current purchase
5 X Long Sleeve Shirt  at $13.99 is $69.95
Total: $69.95
Discounted Total at 30% (staff) is $48.97
Add 1 X Short Sleeve Shirt at $3.99 is $3.99
Current purchase
5 X Long Sleeve Shirt  at $13.99 is $69.95
1 X Short Sleeve Shirt at $3.99 is $3.99
Total: $73.94
Discounted Total at 30% (staff) is $51.76



Another example of displayed information for the Sales(Money) Register in the large textbox with scroll bar for customer:
Current purchase
3 X Medium Sleeve Shirt  at $8.99 is $26.97
6 X Short Sleeve Shirt at $3.99 is $23.94
Total: $50.91
“Invalid Shirt Code! Shirt Code must be LS, MS or SS” .
Deleting Short Sleeve Shirt from current purchase
Current purchase
3 X Medium Sleeve Shirt  at $8.99 is $26.97
Total: $26.97

Example of displayed information for  the Sales(Money) Register in the large textbox with scroll bar after clicking on the “Confirm purchase” button:
Current purchase
3 X Medium Sleeve Shirt  at $8.99 is $26.97
Total: $26.97
Current purchase is confirmed.



Explanation / Answer

from tkinter import * window = Tk() window.title("Welcome to LikeGeeks app") lbl = Label(window, text="Shirt Code:") txt = Entry(window,width=10) lbl1 = Label(window, text="Quantity:") txt1 = Entry(window,width=10) txt2 = Entry(window,width=30) rad1 = Radiobutton(window,text='Customer', value=1) rad2 = Radiobutton(window,text='Staff', value=2) def clicked(): btn1.configure(state='normal') btn2.configure(state='normal') def clicked1(): btn3.configure(state='normal') btn = Button(window, text="Add to purchase", command=clicked) btn1 = Button(window, text="Delete purchase item", state='disabled') btn2= Button(window, text="Confirm purchase", state='disabled', command=clicked1) btn3= Button(window, text="Clear", state='disabled') shirt_info = {'sc':'', 'sn':'', 'Price':''} curr_purchase = {'sc':'', 'Quantity':''} lbl.grid(column=0, row=1) rad1.grid(column=0, row=3) txt.grid(column=1, row=1) txt2.grid(column=1, row=6) lbl1.grid(column=0, row=2) rad2.grid(column=1, row=3) txt1.grid(column=1, row=2) btn.grid(column=0, row=4) btn1.grid(column=1, row=4) btn2.grid(column=2, row=4) btn3.grid(column=3, row=4) textPad =Scrollbar(txt2, orient=HORIZONTAL) if(txt == ""): print ("Invalid Shirt Code! Shirt Code must be LS, MS or SS") window.mainloop()