Develop GUI for an application based on user requirements. The GUI maintains a tour group size, which is initially set t

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Develop GUI for an application based on user requirements. The GUI maintains a tour group size, which is initially set t

Post by answerhappygod »

Develop GUI for an application based on user requirements. The
GUI maintains a tour group size, which is initially set to 5. The
size is limited to a number between 5 and 25. The initial GUI is
shown in Figure Q4(a). When the user clicks on the button Add Pax,
the GUI adds the input number to the tour group size if the
resulting size does not exceed 25. The input field is cleared and
the GUI displays an appropriate message depending on whether the
add is successful.
 Figure Q4(b) shows the GUI when the number 2 is added
successfully. The GUI displays a message including the number added
and the resulting group size.
 Figure Q4(c) shows the GUI when the number 20 is not added
successfully. The GUI displays the reason for the number not being
added.
When the user clicks on the button Remove Pax, the GUI subtracts
the input number from the tour group size if the resulting size is
at least 5. The input field is cleared and the GUI displays an
appropriate message depending on whether the removal is
successful.
 Figure Q4(d) shows the GUI when the number 2 is subtracted
from the group size successfully. The GUI displays a message
including the number removed and the resulting group size.  Figure
Q4(e) shows the GUI when the number 1 is not subtracted
successfully. The GUI displays the reason for the number not being
subtracted.
Develop Gui For An Application Based On User Requirements The Gui Maintains A Tour Group Size Which Is Initially Set T 1
Develop Gui For An Application Based On User Requirements The Gui Maintains A Tour Group Size Which Is Initially Set T 1 (40.36 KiB) Viewed 8 times
Develop Gui For An Application Based On User Requirements The Gui Maintains A Tour Group Size Which Is Initially Set T 2
Develop Gui For An Application Based On User Requirements The Gui Maintains A Tour Group Size Which Is Initially Set T 2 (50.17 KiB) Viewed 8 times
Develop Gui For An Application Based On User Requirements The Gui Maintains A Tour Group Size Which Is Initially Set T 3
Develop Gui For An Application Based On User Requirements The Gui Maintains A Tour Group Size Which Is Initially Set T 3 (43.31 KiB) Viewed 8 times
(b) Implement callback functions to allow the GUI to respond to
events in accordance to the question specifications. Use the insert
method on the ScrolledText object to write into it. For example, if
the ScrolledText object is s, the statement writes the message
Hello on s: s.insert('end', 'Hello\n')
(c) Write Python statements to bind the relevant widgets
identified in Q4(a) to the callback functions in Q4(b).
✓ Tour ABC X Number of Pax: Add Pax Remove Pax Figure Q4(a) ✓ Tour ABC Added 2 to number of pax 5 Total: 71 Adding 20 to number of pax 7 will exceed 25. Cannot addi Number of Pax: Add Pax Remove Pax Figure Q4(c) Tour ABC X Removing 1 from number of pax 5 will be lower than 5. Cannot remove Number of Pax Add Pax Remove Pax Figure Q4(e) Tour ABC X Added 2 to number of pax 5 Total: 7 Number of Pax Add Pax Remove Pax Figure (4(b) Tour ABC exceed 25. Cannot add Remove 2 from number of pax 7 Total: 5 Number of Pax: Add Pax Remove Pax Figure Q4(d) X 4
You are given the partial code for the GUI. import tkinter as tk from tkinter import ttk from tkinter.scrolledtext import Scrolled Text class TourGui: definit__(self): self._numberOfPax = 5 self.win = tk.Tk() self.win.resizable (False, False) self.win.title("Tour ABC") self.create_widgets() self.win.mainloop() def create_widgets(self): output Frame = ttk. Frame(self.win) outputFrame.grid (column=0, row=0, columnspan=2) self.output = Scrolled Text (outputFrame, width=35, height=6, \ wrap=tk.WORD) self.output.grid (column=0, row=0, sticky= 'WE') inputDataFrame = ttk. Frame(self.win) p1_1b1 = ttk. Label (inputDataFrame, text="Number of Pax:") pl_lbl.pack(side=tk. LEFT)
self.numValue = tk.StringVar() self.numValue_Ety ttk. Entry(inputDataFrame, width=18, \ textvariable self.numValue) self.numValue_Ety.pack(side-tk. LEFT) inputDataFrame.grid(column = 0, row = 1, columnspan=2) actionFrame = ttk. Frame(self.win) actionFrame.grid (column=0, row=2, columnspan=2) self.add_btn = ttk.Button(action Frame, text="Add Pax") self.add_btn.pack (side = tk. LEFT) self.remove_btn = ttk.Button(action Frame, text="Remove Pax") self.remove_btn.pack (side = tk. LEFT) (a) List and describe the purpose of the widgets, supporting variables and geometry managers in the given code to implement the GUI.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply