前提・実現したいこと
tkinterで画面遷移するGUIを作成したいです。
発生している問題・エラーメッセージ
エラーメッセージは出ませんがウィンドウが表示されません。
該当のソースコード
python
1import tkinter as tk 2 3def welcome_gui(): 4 #初めての場合のコールバック関数 5 def firsttime_command(): 6 root.destroy() 7 firsttime_gui() 8 9 #過去のデータがある場合のコールバック関数 10 def continuation_command(): 11 root.destroy() 12 continuation_gui() 13 14 # メインウィンドウ作成 15 root = tk.Tk() 16 #GUIの名前をつける 17 root.title("failure") 18 #画面のサイズを変える 19 root.geometry("500x300") 20 #ソフトウェアの名前を表示 21 lbl_name = tk.Label(root, text ="software_name" , font=("", 50)) 22 lbl_name.grid() 23 #位置を変える 24 lbl_name.place(x=90, y=0) 25 #はじめての場合 26 button1 = tk.Button(root, text="case1", height=15, width=15, command = firsttime_command) 27 button1.pack() 28 button1.place(x=35, y=130) 29 #昨日のデータがある場合 30 button2 = tk.Button(root, text="case2", height=15, width=15, command=continuation_command) 31 button2.pack() 32 button2.place(x=300, y=130) 33 34 root.mainloop() 35 36 def firsttime_gui(): 37 #ウィンドウの作成 38 root = tk.Tk() 39 root.title("firsttime") 40 root.geometry("500x300") 41 #csvファイル読み込みのためのテキストボックス 42 txtb_file = tk.Entry(width=20) 43 txtb_file.grid() 44 txtb_file.place(x=70, y=68) 45 lbl_csv = tk.Label(root, text="cvs file") 46 lbl_csv.grid() 47 lbl_csv.place(x=20, y=70) 48 49 root.mainloop() 50 51 def continuation_gui(): 52 #ウィンドウの作成 53 root = tk.Tk() 54 root.title("contibuation") 55 root.geometry("500x300") 56 button_start= tk.Button(root, text = "start") 57 button_start.pack() 58 59 root.mainloop()
試したこと
root.mainllopやtk.mainloopは試しました。
初心者で他に試せることもわかりません。。
補足情報(FW/ツールのバージョンなど)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/12/13 04:20