[英]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.