[英]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. 问题是您当前正在为text
参数传递一个元组。 Instead, you should be passing a string. 相反,您应该传递一个字符串。 You can use str.format
to insert the dictionary length into this string: 您可以使用str.format
将字典长度插入此字符串中:
self.status_bar = Label(self.status_bar, text="There are total {} entries in dictionary.".format(len(dictionary_data)), bg="yellow", relief=FLAT)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.