我一直在制作的Clicker GUI一直很顺利,然而,每当我更改代码时,至少需要半个小时才能达到我可以测试它的程度(如果运气好的话,甚至更多反对我)如果我犯了一个错误,那么我必须修复它并再次重新启动等待过程,只是为了找到另一个我以前无法测试的错误。我之前尝试过添加一个作弊码,只是跳到了某个阶段,但它没有用,我不明白为什么。
def New_Option1(self):
self.labelVariable3 = tkinter.StringVar()
label3 = tkinter.Label(self, textvariable=self.labelVariable3, anchor='e', fg='black')
label3.grid(column=0, row=2,columnspan=2, stick='EW')
self.labelVariable3.set(u" Mana:")
self.labelVariable4 = tkinter.StringVar()
label4 = tkinter.Label(self, textvariable=self.labelVariable4, anchor='w', fg='black')
label4.grid(column=2, row=2, stick='EW')
self.labelVariable4.set(Mana)
self.labelVariable5 = tkinter.StringVar()
label5 = tkinter.Label(self, textvariable=self.labelVariable5, anchor='w', fg='black')
label5.grid(column=0, row=0, stick='EW')
self.labelVariable5.set('Level:')
self.labelVariable6 = tkinter.StringVar()
label6 = tkinter.Label(self, textvariable=self.labelVariable6, anchor='w', fg='black')
label6.grid(column=1, row=0, stick='EW')
self.labelVariable6.set(Level)
button2 = tkinter.Button(self, text=u"Concentrate", command=self.OnButtonClick2)
button2.grid(column=2, row=4)
def New_Option2(self):
self.labelVariable6.set(Level)
self.labelVariable7 = tkinter.StringVar()
label7 = tkinter.Label(self, textvariable=self.labelVariable7, anchor='e', fg='black')
label7.grid(column=0, row=3, columnspan=2, stick='EW')
self.labelVariable7.set(' Monsters:')
self.labelVariable8 = tkinter.StringVar()
label8 = tkinter.Label(self, textvariable=self.labelVariable8, anchor='w', fg='black')
label8.grid(column=2, row=3, stick='EW')
self.labelVariable8.set(Monsters)
button3 = tkinter.Button(self, text=u" Summon ", command=self.OnButtonClick3)
button3.grid(column=0, row=5, columnspan=2)
button4 = tkinter.Button(self, text=u" Fireball ", command=self.OnButtonClick4)
button4.grid(column=2, row=5)
def New_Option3(self):
self.labelVariable6.set(Level)
self.labelVariable9 = tkinter.StringVar()
label9 = tkinter.Label(self, textvariable=self.labelVariable9, anchor='w', fg='black')
label9.grid(column=3, row=0, stick='EW')
self.labelVariable9.set('Gold:')
self.labelVariable10 = tkinter.StringVar()
label10 = tkinter.Label(self, textvariable=self.labelVariable10, anchor='w', fg='black')
label10.grid(column=4, row=0, stick='EW')
self.labelVariable10.set(Gold)
self.labelVariable11 = tkinter.StringVar()
label11 = tkinter.Label(self, textvariable=self.labelVariable11, anchor='e', fg='black')
label11.grid(column=3, row=1, columnspan=2, stick='EW')
self.labelVariable11.set('Teachers:')
self.labelVariable12 = tkinter.StringVar()
label12 = tkinter.Label(self, textvariable=self.labelVariable12, anchor='w', fg='black')
label12.grid(column=5, row=1, stick='EW')
self.labelVariable12.set(Teachers)
button5 = tkinter.Button(self, text=u" Hire ", command=self.OnButtonClick5)
button5.grid(column=3, row=4, columnspan=2)
button6 = tkinter.Button(self, text=u" Teacher ", command=self.OnButtonClick6)
button6.grid(column=3, row=5, columnspan=2)
def New_Option4(self):
self.labelVariable6.set(Level)
self.labelVariable13 = tkinter.StringVar()
label13 = tkinter.Label(self, textvariable=self.labelVariable13, anchor='e', fg='black')
label13.grid(column=3, row=2, columnspan=2, sticky='EW')
self.labelVariable13.set('Mages:')
self.labelVariable14 = tkinter.StringVar()
label14 = tkinter.Label(self, textvariable=self.labelVariable14, anchor='w', fg='black')
label14.grid(column=5, row=2, sticky='EW')
self.labelVariable14.set(Mages)
self.labelVariable15 = tkinter.StringVar()
label15 = tkinter.Label(self, textvariable=self.labelVariable15, anchor='e', fg='black')
label15.grid(column=3, row=3, columnspan=2, sticky='EW')
self.labelVariable15.set('Summoners:')
self.labelVariable16 = tkinter.StringVar()
label16 = tkinter.Label(self, textvariable=self.labelVariable16, anchor='w', fg='black')
label16.grid(column=5, row=3, sticky='EW')
self.labelVariable16.set(Summoners)
button7 = tkinter.Button(self, text=u" Mage ", command=self.OnButtonClick7)
button7.grid(column=5, row=4)
button8 = tkinter.Button(self, text=u" Summoner ", command=self.OnButtonClick8)
button8.grid(column=5, row=5)
def New_Option5(self):
self.labelVariable6.set(Level)
self.labelVariable17 = tkinter.StringVar()
label17 = tkinter.Label(self, textvariable=self.labelVariable17, anchor='e', fg='black')
label17.grid(column=0, row=6, columnspan=3, sticky='EW')
self.labelVariable17.set("Monsters to Battle:")
self.labelVariable18 = tkinter.StringVar()
label18 = tkinter.Label(self, textvariable=self.labelVariable18, anchor='e', fg='black')
label18.grid(column=0, row=7, columnspan=3, sticky='EW')
self.labelVariable18.set("Mages to Battle:")
self.labelVariable19 = tkinter.StringVar()
label19 = tkinter.Label(self, textvariable=self.labelVariable19, anchor='e', fg='black')
label19.grid(column=0, row=8, columnspan=3, sticky='EW')
self.labelVariable19.set("Summoners to Battle:")
self.entryVariableMonsters = tkinter.StringVar()
self.entry = tkinter.Entry(self, textvariable=self.entryVariableMonsters)
self.entry.grid(column=3, row=6, columnspan=3, stick='EW')
self.entryVariableMages = tkinter.StringVar()
self.entry = tkinter.Entry(self, textvariable=self.entryVariableMages)
self.entry.grid(column=3, row=7, columnspan=3, stick='EW')
self.entryVariableSummoners = tkinter.StringVar()
self.entry = tkinter.Entry(self, textvariable=self.entryVariableSummoners)
self.entry.grid(column=3, row=8, columnspan=3, stick='EW')
self.labelVariable20 = tkinter.StringVar()
label20 = tkinter.Label(self, textvariable=self.labelVariable20, anchor='e', fg='black')
label20.grid(column=0, row=9, columnspan=2, sticky='EW')
self.labelVariable20.set("Victories:")
self.labelVariable21 = tkinter.StringVar()
label21 = tkinter.Label(self, textvariable=self.labelVariable21, anchor='e', fg='black')
label21.grid(column=0, row=10, columnspan=2, sticky='EW')
self.labelVariable21.set("Defeats:")
self.labelVariable22 = tkinter.StringVar()
label22 = tkinter.Label(self, textvariable=self.labelVariable22, anchor='w', fg='black')
label22.grid(column=2, row=9, sticky='EW')
self.labelVariable22.set(Victories)
self.labelVariable23 = tkinter.StringVar()
label23 = tkinter.Label(self, textvariable=self.labelVariable23, anchor='w', fg='black')
label23.grid(column=2, row=10, sticky='EW')
self.labelVariable23.set(Defeats)
button10 = tkinter.Button(self, text=u'Relics:', command=self.OnButtonClick10)
button10.grid(column=3, row=9, rowspan=2, sticky='EW')
self.labelVariable25 = tkinter.StringVar()
label25 = tkinter.Label(self, textvariable=self.labelVariable25, anchor='w', fg='black')
label25.grid(column=4, row=9, rowspan=2, sticky='EW')
self.labelVariable25.set(Relics)
button9 = tkinter.Button(self, text=u"TO BATTLE!", command=self.OnButtonClick9)
button9.grid(column=5, row=9, rowspan=2, sticky='EW')
self.labelVariable24 = tkinter.StringVar()
label24 = tkinter.Label(self, textvariable=self.labelVariable24, anchor='e', fg='black')
label24.grid(column=0, row=98, columnspan=2, sticky='EW')
self.labelVariable24.set("Current Bonus:")
self.labelVariable26 = tkinter.StringVar()
label26 = tkinter.Label(self, textvariable=self.labelVariable26, anchor='w', fg='black')
label26.grid(column=2, row=98, columnspan=2, sticky='EW')
self.labelVariable26.set("None")
我无法添加整个代码,因为它超出了字符数限制,所以我只是添加了不同的阶段
每个" New_OptionX"命令是一个新阶段,现在我让他们设置输入某些触发器,但我想使用一个小部件一次激活它们,但我不希望任何其他人使用我的程序能够做同样的事情。因此,为什么我首先想要作弊码。任何人都可以帮助我吗?
答案 0 :(得分:0)
""
可以压缩:
self.labelVariable3 = tkinter.StringVar()
label3 = tkinter.Label(self, textvariable=self.labelVariable3, anchor='e', fg='black')
label3.grid(column=0, row=2,columnspan=2, stick='EW')
self.labelVariable3.set(u" Mana:")
使用Label和Entry创建自定义类也应该很有用。
在测试时,没有什么能阻止你在文件的末尾写下来:
label3 = tkinter.Label(self, text=u" Mana:", anchor='e', fg='black')
label3 =.grid(column=0, row=2,columnspan=2, sticky='EW')