I'm trying to make my program use tkinter's message box. So far it's working, but now I'm having trouble getting it to include a math equation in the title.
This is my code
while lives >= 0: x = random.randrange(1, 12) y = random.randrange(1, 12) name = numinput(x"*"y, "Answer:", minval=1, maxval=144)`
I also tried it
name = numinput("x"*"y", "Answer:", minval=1, maxval=144)
and
name = numinput(x*y, "Answer:", minval=1, maxval=144)
The first two it gives an error but the last one it gives the answer to my question but I want it to say something like (8*4)
The title is a string, but all your attempts are not strings.
use
name = numinput(f"{x} * {y}", "Answer:", minval=1, maxval=144)
The above is the detailed content of Confused with message boxes. For more information, please follow other related articles on the PHP Chinese website!