tkinterでまず、親ウィンドウにラジオボタンを配置し、okが押されたら
one_win() メソッドを呼んでサブウィンドウを作り、またラジオボタンを配置する。
ということをやりたいのですが、サブウィンドウにラジオボタンが配置されません...
エラーが出るわけでもなく原因がわからずつまずいています。
ご回答の程よろしくお願いいたします。
python3.6.2
macOS10.12.6
import
1import os 2import shutil 3import tkinter 4from tkinter import * 5 6root = tkinter.Tk() 7text = ['aaa', 'bbb', 'ccc', 'ddd'] 8 9 10def one_win(event): 11 one_win = Toplevel() 12 action2 = IntVar() 13 action2.set(0) 14 15 i = 0 16 for i in range(0, 4): 17 Radiobutton(text = files[i], variable = action2, value = i).pack(anchor='w') 18 19 20action = IntVar() 21action.set(0) 22 23Label(text = text[0]).pack() 24 25i = 0 26for i in range(0, 4): 27 Radiobutton(text = files[i], variable = action, value = i).pack(anchor='w') 28 29button1 = tkinter.Button(root, text='OK',width=30) 30button1.bind("<Button-1>",one_win) 31button1.pack() 32 33root.mainloop() 34
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。