[Tutor] Tkinter message box

Steven D'Aprano steve at pearwood.info
Mon Jun 25 06:07:08 CEST 2012


On Sun, Jun 24, 2012 at 10:00:57PM -0400, ken wrote:
> 
> If this belongs on another list, please let me know. I am using PYTHON 3
> and tkinter. I have been playing around with messagebox. Is there any
> way I can display the value of a variable inside a message box?

Of course. tkinter doesn't care where the values come from, you can use 
a variable just as easily as a static string literal.

Using Python 3.2:


>>> import tkinter.messagebox
>>> import time
>>> title = "a trivial example".title()
>>> message = "It is now %s, do you know where your computer is?" % time.asctime()
>>> tkinter.messagebox.showinfo(title, message)
'ok'


If that's not the sort of thing you mean, please show us what code you 
are using.



-- 
Steven


More information about the Tutor mailing list