おかげさまで、私はシンプルなGUIを書いて、ボタン「リンゴジュース」をクリックして別のGUIを開きたいと思っています。しかし、 "apple juice" GUIが起動時に開きます。Python 3 GUIボタンをクリックして別のGUIを開く - 起動しない
コードに間違った文字を入力しましたか?そうでない場合は、ボタンをクリックしたときにのみどうすれば開くことができますか?ここに私のコード:
import Tkinter
###############
win = Tkinter.Tk()
win.geometry("500x25")
Tkinter.Label(win, text="You've chosen apple juice!", font="bold").pack()
##############
root = Tkinter.Tk()
root.geometry("500x300")
# Label asking what drink
Tkinter.Label(root, text="What drink would you like?", bg="goldenrod", font="bold").pack()
# white space
Tkinter.Label(root, text="").pack()
#Choices
Tkinter.Label(root, text="Whichever choice you want, simply press the buton!").pack()
# Apple juice button
def apple_juice():
win.mainloop()
Tkinter.Button(root, text="Apple Juice", bg="SkyBlue1", command=apple_juice).pack()
root.mainloop()
は誰がどのようにコードの入力ブロック全体ではなく、個々のものに知っている場合、それをいただければ幸いです。 –