[英]How to eliminate curly braces in Label (text=)
如何消除“共有”和“字典中的条目”周围的花括号
self.status_bar = Label(self.status_bar, text=("There are total", len(dictionary_data), "entries in dictionary."), bg="yellow", relief=FLAT)
问题是您当前正在为text
参数传递一个元组。 相反,您应该传递一个字符串。 您可以使用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.