I have a program I'm testing in Python 3.1 in Windows XP using tkinker to dispay random quotes. It works except for two things.
1) The program displays a random quote of the day when it's invoked, but I want to have a "Next quote" button so that additional random quotes can be displayed. Here are the parts of the program were I get the first quote: ################################ def get_random_quote(): # create a function to get a random quote from quote_dict rq = (random.randrange(len(quote_dict))+1) # pick a random entry from the quote dictionary return rq def output_quote(): rand_quote = get_random_quote() # get a random quote quote = quote_dict[rand_quote][1] # put the quote in a string varible author = quote_dict[rand_quote][0] # put the author in a string variable om = (quote+"\n\n"+author) # format the output string variable return om out_message = output_quote() msg_widget = Message(win, anchor = NW, justify = LEFT, width = 1000, bd= 2, bg = "white", relief = SOLID, text=out_message) ################################ Here is my button the get the next quote: ################################ next_button = Button(win, text="Next Quote", command=output_quote()) # create button widget next_button.pack(side=LEFT) ################################ Even though I'm calling the same function, output_quote(), the screen is not getting refreshed. There is no error, just the new quote is not showing up in the message box. How do I refresh the message box? 2) The message widget seems to be sizing based on the size of the text you present to it. For a small quote it's small, for a longer quote it streches out wide and then adds more lines. I'd like to present a consistent sized message box when the program is run, no matter if the text is small or large, but I can't figure out how to do that. In other words, I'd like the message widget in question 1 above to display as a box capable of storing, say, 1,000 characters, even if I only give it 100, so the program looks the same every time it's invoked. Is there a way to make a default sized message widget? -- Frank L. "Cranky Frankie" Palmeri _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor