0
ボタンを使用してコードの一部をアクティブにしたいとします。誰かがこれで私を助けることができればコードの特定の部分を「アクティブにする」方法
from tkinter import *
window = Tk()
window.title('Adventure')
c = Canvas(window, height=360, width=640, bg='black')
c.pack()
system = 1
def start():
c.delete(anfang1)
anfangbutton.destroy()
if system == 1:
anfang1 = c.create_text(320, 180, text='Adventure', fill='white', font=('Halvatica', 50))
anfangbutton = Button(window, text='Start', command=start)
anfangbutton.place(x=320, y=250) # I want that if you press the button, start is activated and the value of "system" goes to 2, so the next part begins
if system == 2:
anfang2 = c.create_text(320, 180, text='Adventure', fill='white', font=('Halvatica', 50))
は、私には理解されるか、別のものを持っている:あなたがボタンを押したときに、変数の値は、私のコードの別の部分を活性化し、他の量に設定されている、ように私は何かを試してみましたここで
関数 'start'は変数' system'を変更することができます - 何が問題なのですか?あなたが何をしようとしているのかははっきりしていませんが、 'start()'が呼ばれたときに 'system'インクリメント(あるいはあなたが望むもの)を増やすことは難しくありません。 –