我曾试图使一些小型项目让我开始在Tkinter上,我想制定一套规则,在你点击一个县时,它将下一个规则付诸实施。 请问一下如何做到这一点。
基本上,在我所知甚少的情况下,一经打上了差错的东西。 这是十条规则,试图列入一个清单,并利用职能执行每项规则。 不能像你能够告诉的那样真正地做事。
from tkinter import *
rules=Tk()
rules.title("Rules")
rules.geometry("200x200")
def click():
rule_label1 = rule_label1(rules, text=("The rules are quite simple"))
rule_label2 = rule_label2(rules, text=("You get to roll two dice. The total score of the dice is added onto your personal score so for example, if you roll a 5 and a 6, you would get 11"))
rule_label3 = rule_label3(rules, text=("If the total that you get is an even number then excellent because you get an extra 10 points"))
rule_label4 = rule_label4(rules, text=("Bad news if your total is an add number though because that is -5 points"))
rule_label5 = rule_label5(rules, text=("Double rolls allow you to roll an extra dice which is also added onto your total"))
rule_label6 = rule_label6(rules, text=("Scores cannot go below 0 at any point"))
rule_label7 = rule_label7(rules, text=("There will be 5 rounds and the person whose total is the highest wins"))
rule_label8 = rule_label8(rules, text=("In the rare case of a tie, a single dice roll will decide who wins overall"))
rule_label9 = rule_label9(rules, text=("Enjoy!!!"))
rule_label10 = rule_label10(rules, text=("You can now close this screen."))
button = Button(rules, text="Click for next line", font="calibri", padx=50, pady=50, command=click, fg="red", bg="Green")
button.pack()
rules.mainloop()