progress456
progress456

Reputation: 67

How to delete curly brackets from tkinter label

Pretty straightforward question, just wondering if there's any .format() way to remove squiggly brackets.

Here's my code:

from tkinter import *

root = Tk()

my_list = ['Air Conditioning']

Label_1 = Label(root, text=my_list)
Label_1.pack()

root.mainloop()

Current output is: {Air Conditioning}

Trying to get: Air Conditioning

Upvotes: 0

Views: 300

Answers (1)

Liam
Liam

Reputation: 400

You're passing the list, instead try passing the first element in the list, like:

from tkinter import *

root = Tk()

my_list = ['Air Conditioning']

Label_1 = Label(root, text=my_list[0])
Label_1.pack()

root.mainloop()

Alternatively, remove the square brackets and just pass a string:

from tkinter import *

root = Tk()

my_string = 'Air Conditioning'

Label_1 = Label(root, text=my_string)
Label_1.pack()

root.mainloop()

Upvotes: 3

Related Questions