Skip to content
Advertisement

Why am I getting ugly curly brackets around my text in the label widget? – Tkinter

I’m getting curly brackets around the text in my label widget. The output is {Total tries: 0} instead of Total tries: 0.

Here is a short version of my code:

JavaScript

Advertisement

Answer

JavaScript

There is a comma at the end of the line. The comma changes the value being assigned to self.label["text"] from a string to a tuple. Remove the comma, and the curly braces get removed.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement