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

Python Gap Filling Consider a Python GUI program that produces a window with the

ID: 3842095 • Letter: P

Question

Python Gap Filling

Consider a Python GUI program that produces a window with the following widgets:

a text box to display the value of one element of a given list (e.g., a list of the five vowels);

a button to retrieve the previous value in that list (if there is one). This button is disabled if there is no previous value in the list.

a button to retrieve the next value in that list (if there is one). This button is disabled if there is no next value in the list.

a label to display the number of the item being displayed and the total number of items (e.g., "1/5")

Possible ans

button Button window command previous item() Text Label Window Image command next item next item command next item previous item command previous item

Explanation / Answer

It should be something like this -
buttonPrev = Button(window, text="<< prev", command=previous_item(), state=DISABLED)
buttonNext = Button(window, text="<< prev", command=next_item())

^State of the button is to be changed (DISABLED or NORMAL) with value of counter in functions: previous_item() and next_item().
^Counter should also increment or decrement accordingly.