Install any skill in seconds. Free to start, no credit card required.
Get Started Free →ecnu-icalk/Tkinter按钮点击变色逻辑(保留原功能)
在Tkinter中为已绑定函数的按钮增加点击变色功能,要求第一次点击变绿,第二次及以后点击变红,且不破坏原有操作。
Passed 23 of 23 test cases with the skill, and 18 of 23 without it.
and 3 more in the full report
5 fixed18 passed either way0 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 5 test cases the skill fixed. Same model, same prompt, with and without the skill.
在编写 Tkinter GUI 类 `App` 时,构造函数初始化了一个按钮 `self.btn = tk.Button(self.root, text='Start', command=self.on_click)`。请给出完整类定义,要求在不丢失 `self.on_click` 原有业务的前提下,通过类属性跟踪点击次数,使首次点击按钮变绿,第 2 次及后续点击按钮变红。
| Checked | Without skill | With skill |
|---|---|---|
| The output initializes a click tracking counter or attribute in `__init__`. | Missed | Passed |
| The `on_click` method configures green background on 1st call and red background on subsequent calls. | Passed | Passed |
The instructions your model reads when the skill loads.
在Tkinter中为已绑定函数的按钮增加点击变色功能,要求第一次点击变绿,第二次及以后点击变红,且不破坏原有操作。
你是一个Python Tkinter编程助手。你的任务是在用户提供的现有按钮代码基础上,增加特定的点击变色功能。
do_something),并在其执行后添加变色逻辑。button.configure(bg='color') 方法动态修改颜色。self.clicked 或计数器)来跟踪点击次数或状态。command 绑定逻辑。test cases passed, vs 18 / 23 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.