python - 按钮变化不同,功能相同
问题描述
我试图使所有按钮都是单边的,但是在开头定义的按钮看起来不同,尽管稍后定义的按钮与按钮相同。我遇到的另一个问题是更改标题栏的颜色。
我稍后尝试定义原始按钮“退出”,但它仍然看起来像那样,选项按钮仍然像那样出现。[稍后显示]
def createWidgets(self):
self.question = tk.Label(self, text="Welcome to Quiz App\nEach round we will ask you a question\nEach round you will have to\nchoose the correct answer\nGet it right and get a point\nGet it wrong and you don't.")
self.question.grid(row=1, column=1, columnspan=2)
self.ocontinue = tk.Button(self, width=12)
self.ocontinue["text"] = "Continue"
self.ocontinue["command"] = self.ogcont
self.ocontinue.grid(column=1, row=2, columnspan=2, padx=1, pady=1)
self.QUIT = tk.Button(self, text="Quit", width=8,fg="red", command=root.destroy)
self.QUIT.grid(column=1, row=7, columnspan=2, padx=5, pady=5)
self.question.config(bg="#404040", fg="white")
self.ocontinue.config(highlightbackground="#404040")
self.QUIT.config(highlightbackground="#404040")
root.config(bg="#404040")
<~ the original configs
def darkMode(self):
self.answercheck.config(bg="#404040", fg="white")
self.ocontinue.config(highlightbackground="#404040")
self.option1.config(highlightbackground="#404040", highlightthickness=2)
self.option2.config(highlightbackground="#404040", highlightthickness=2)
self.option3.config(highlightbackground="#404040", highlightthickness=2)
self.option4.config(highlightbackground="#404040", highlightthickness=2)
<~ the configs applied to the option buttons.
解决方案
推荐阅读
- asp.net-mvc - 从数据库获取数据时对象引用错误
- java - 如何从列表中获取仅重复对象的列表
- php - 我的代码有问题,它说 Undefined variable: row in C:\xampp\htdocs\test\transaksi_toko\read_stock.php 在第 85 行
- automation - CircleCI - 即使退出代码是构建步骤之一的选项,也可以继续部署
- powershell - 如何在循环内正确选择已处理的 XML 元素(使用 PowerShell)
- reactjs - 无法在编辑视图中读取未定义的属性“hasOwnProperty”
- python - 在 Python 中将数组转换为一系列参数
- html - 在新选项卡中显示 PDF
- ssl - 处理 local_name 中的多个域
- java - 在 android studio 中的活动之间传递数据