Python MessageBox display variable

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Python MessageBox display variable

Re: Python MessageBox display variable

by Ben the Coder » 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.

Re: Python MessageBox display variable

by Drugwash » 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. ;)

Python MessageBox display variable

by Ben the Coder » 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

Top