-1

I try to make a label with text with a "x" variable inside the text. My problem is that the label has curly brackets. here is a sample of my code. how do I remove them?

victory_screen=Label(root,compound=CENTER, text=("PLAYER 1 WINS with 
",x,"points""\n""\n""\n""\n""\n""\n"))
  • Possible duplicate of [How do I put a variable inside a String in Python?](https://stackoverflow.com/questions/2960772/how-do-i-put-a-variable-inside-a-string-in-python) – Nae Dec 17 '17 at 14:44
  • you have to create one string using concatenation. Or use [string formatting: PyFormat.info](https://pyformat.info/) – furas Dec 17 '17 at 14:49

1 Answers1

1

Simply replace ,s with +s. As in:

victory_screen=Label(root,compound=CENTER, text=("PLAYER 1 WINS with " + x + " points""\n""\n""\n""\n""\n""\n"))
Nae
  • 14,209
  • 7
  • 52
  • 79