Page 278 -
P. 278

building a graphical user interface







           choice = input(prompt)
           while choice != '0':
               if choice == '1':
                   number_asked = number_asked + 1
                   number_correct = number_correct + 1                Turn this code into the
                   wait_finish(correct_s.play())                     “play_correct_sound()”
               if choice == '2':                                      function.
                   number_asked = number_asked + 1
                                                                    Turn this code into the
                   number_wrong = number_wrong + 1                 “play_wrong_sound()”
                   wait_finish(wrong_s.play())                      function.
               choice = input(prompt)


           print("You asked " + str(number_asked) + " questions.")
           print(str(number_correct) + " were correctly answered.")
                                                                                       Displaying the
                                                                                       summary remains a
           print(str(number_wrong) + " were answered incorrectly.")
                                                                                       requirement, too.






                             With the code you need identified, you were to take the time
                             to update your GUI application with the new functions and
                             whatever other code you’ve extracted from the non-GUI
                             program.

                             You were asked to produce a new program that is a
                             combination of your existing GUI code and the extracted
                             code from this program.





                                                                            Turn the page for the
                                                                            updated code solution...









                                                                                       you are here 4    243
   273   274   275   276   277   278   279   280   281   282   283