Python MessageBox display variable

Discuss other programming languages besides AutoHotkey
Ben the Coder

Python MessageBox display variable

13 Sep 2022, 18:42

Hi guys,
I'm using Python to have a messagebox display a variable.
Currently, my code looks like this:

Code: Select all

from tkinter import messagebox
myvar = "Name"
messagebox.showinfo("Title here", "You opened" % name)
I've checked out this, but it doesn't seem to be happening for me. Can someone with more expertise help me with this?
Ben
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: Python MessageBox display variable

15 Sep 2022, 15:18

If the format in that example still stands you could try

Code: Select all

messagebox.showinfo("Title here", "You opened %s" % myvar)
But that's only a theory. ;)
Part of my AHK work can be found here.
Ben the Coder

Re: Python MessageBox display variable

16 Sep 2022, 09:38

Drugwash wrote:
15 Sep 2022, 15:18
If the format in that example still stands you could try

Code: Select all

messagebox.showinfo("Title here", "You opened %s" % myvar)
But that's only a theory. ;)
Thanks! I'll try it out.

Return to “Other Programming Languages”

Who is online

Users browsing this forum: No registered users and 116 guests