<snip> > def calc_total(self): > """Update the text widget if they order Spaghetti Bolognese. """ > try: > int(spag_ent.get()) > except: > message="You have to enter a number in the quantity box. \n" <snip> > >The 'calc_total' function is supposed to calculate the users bill and then >display it in the text widget, but every time I try it, it comes up as 0. Can >anyone help me? > It struck me that you're not assigning int(spag_ent.get()) to any variable: spaghettiAmount = int(spag_ent.get()) Moreover, I'd try to create the program in such a way that it doesn't become a headache to change the menu (for instance, to add a new pasta). Perhaps by using a dctionary as a parameter: menu = {"spaghetti": 4.50, "macaroni": 2.10, "calzone": 6.00} Your example reminds me of one chapter of Head First Design Patterns (O'Reilly). Would be interesting to compare your approach with the one in the book.
Albert-Jan _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor