简体   繁体   中英

How to eliminate curly braces in Label (text=)

How to eliminate curly braces around "There are total" and "entries in dictionary"

在此处输入图片说明

self.status_bar = Label(self.status_bar, text=("There are total", len(dictionary_data), "entries in dictionary."), bg="yellow", relief=FLAT)

The problem is that you are currently passing a tuple for the text parameter. Instead, you should be passing a string. You can use str.format to insert the dictionary length into this string:

self.status_bar = Label(self.status_bar, text="There are total {} entries in dictionary.".format(len(dictionary_data)), bg="yellow", relief=FLAT)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM