这更像是一个个人特定的问题,因此它不会对其他人产生很大的吸引力,但我需要帮助制定我的进度条,我已经从其他一些堆栈链接中删除了大部分内容,但它只是保持空白任何帮助?
这是我构建进度条的地方(它渲染得很好)
self.pb = ttk.Progressbar(self.pbLabel, orient="horizontal", length=200, mode="indeterminate")
然后我想在按下此按钮时调用此功能:
按钮:
self.add_points = tk.Button(self.settingsLabel,
text=u"Add points",
command=self.gainPoint)
功能:
def gainPoint(self):
# run once the player has completed a word
if self.difficulty == self.difficulties["Easy"]:
self.pointValue += 1
if self.difficulty == self.difficulties["Medium"]:
self.pointValue += 1.5
if self.difficulty == self.difficulties["Hard"]:
self.pointValue += 2
while self.pointValue >= (self.levelValue + 5):
self.levelValue += 1
self.pointValue -= (self.levelValue + 5)
if self.pointValue < 0:
self.pointValue = 0
self.pointsVar.set(self.pointValue)
self.levelVar.set(self.levelValue)
self.pb["maximum"] = self.levelValue + 5
self.pb["value"] = self.pointValue
我认为当我执行self.pb["value"]
或self.pb["maximun"]
请帮忙时,有事可做!
当我按下self.add_points
按钮时应该根据self.levelValue + 5