[Tutor] Tkinter message box

Alan Gauld alan.gauld at btinternet.com
Mon Jun 25 09:21:39 CEST 2012


On 25/06/12 03:00, 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?

Yes, just insert it intro the message string prior to displaying the 
messagebox:

import tkMessageBox
num = 6
tkMessageBox.showinfo("Village News", "Message for number %d" % num)

HTH,
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/





More information about the Tutor mailing list