--
※ この募集は締め切られました。
ボタンの消し方について
【教えてもらいたいこと】
プログラミング/ゲームプログラム Python
【利用目的】
技術的な質問・相談
【具体的な相談内容】
以下は私がボタンGUIを消すために作成したプログラムです。第3学年に進んだらもはや「to the second grade」というボタンには消えてえほしいと思っています。ボタンのGUIそのものを消す(画面からみえなくなる方法)をご教示いただける人を探しています。
追伸、place_foget()やdestroy()ためしましたがだめでした。
import tkinter
root = tkinter.Tk()
root.title("ボタン")
cvs = tkinter.Canvas(width=200, height=250,bg="white")
def first():
global first,second, third,last
cvs.delete("GRADE")
cvs.create_text(100,200,text="第一学年", font=("HGS創英角ポップ体", 15),tag="GRADE")
fiest = tkinter.Button(root, text="to the second grade", command=second).place(x=30, y=0)
def second():
global first,second, third,last
cvs.delete("GRADE")
cvs.create_text(100,200,text="第二学年", font=("HGS創英角ポップ体", 15),tag="GRADE")
second = tkinter.Button(root, text="to the third grade", command=third).place(x=30, y=30)
#first.place_forget()
first.destroy()
def third():
global first,second, third,last
cvs.delete("GRADE")
cvs.create_text(100,200,text="第三学年", font=("HGS創英角ポップ体", 15),tag="GRADE")
third = tkinter.Button(root, text="to the last grade", command=last).place(x=30, y=60)
def last():
global first,second, third,last
cvs.delete("GRADE")
cvs.create_text(100,200,text="卒業", font=("HGS創英角ポップ体", 15),tag="GRADE")
#last = tkinter.Button(root, text="graduation").place(x=30, y=90)
def main():
first()
cvs.pack()
main()
root.mainloop()
【希望相談スタイル】
技術的な質問・相談
【目安予算】
10000円