implementing the interaction you might be little scared at this point that the constructor for our gui interface was so complex even simple graphical interfaces involve many independent components getting them all set up and initialized is often the most tedious part of coding the interface now that we have that part out of the wayactually writing the code that handles the interaction will not be too hardprovided we attack it one piece at time let' start with the simple output methods setmoney and showresult these two methods display some text in our interface window since our constructor took care of creating and positioning the relevant text objectsall our methods have to do is call the settext methods for the appropriate objects def setmoney(selfamt)self money settext("${ }format(amt)def showresult(selfmsgscore)if score text "{ }you win ${ }format(msgscoreelsetext "you rolled { }format(msgself msg settext(textin similar spiritthe output method setdice must make call to the setvalue method of the appropriate dieview objects in dice we can do this with for loop def setdice(selfvalues)for in range( )self dice[isetvalue(values[ ]take good look at the line in the loop body it sets the ith die to show the ith value as you can seeonce the interface has been constructedmaking it functional is not overly difficult our output methods are completed with just few lines of code the input methods are only slightly more complicated the wanttoplay method will wait for the user to click either "roll diceor "quit we can use our choose helper method to do this def wanttoplay(self)ans self choose(["roll dice""quit"]self msg settext(""return ans ="roll diceafter waiting for the user to click an appropriate buttonthis method then clears out any message-such as the previous results--by setting the msg text to the empty string the method then returns boolean value by examining the label returned by choose