Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
配列に基づく迷路ゲームを作成しています。プレイヤー (値 1) が終点 (値 -5) に到達すると、ラベルがレベル 1 からレベル 2 に変わります。
レベル機能の実装に問題があります。誰かが私を助けることができるかどうか疑問に思っていました。「構成」を使用していると思われますが、うまくいきません。
グローバル変数としてレベルがあります。プレーヤーが最後に到達すると、レベル = 2 を調整し、次に init(canvas) を呼び出します。
Tkinter stringVar を使用して、このようなラベルにリンクします
current_level = Tkinter.StringVar() Tkinter.Label(master, textvariable=current_level)
次に、ラベルのテキストを変更するには
current_level.set('Level 2')
等