すごく初歩的な事を聞きます。よろしくお願いします。
Tkinterで2つボタンを並べようと以下のコードを書きましたが、一個しか表示されません。
何が悪いのでしょうか?
2つボタンを並べ、一つ目を押すとEBtest()が実行され、二個目を押すとプログラム終了という感じにしたいです。
Python
1 title="Title" 2 width = 1000 3 height = 130 4 x = 200 5 y = 00 6 mes = "OK?" 7 8 root = tkinter.Tk() 9 root.attributes("-topmost", True) 10 root.title(title) 11 root.geometry('{}x{}+{}+{}'.format(width, height, x, y)) 12 13 label = tkinter.Label(root, text=mes) 14 label.pack() 15 button1 = tkinter.Button(root, text='COPY', command=lambda:EBtest(), 16 width=40, height=40, fg='#ff0000', bg='#FFFF00', 17 font=(u'MS ゴシック', 20, 'bold')) 18 button2 = tkinter.Button(root, text='EXIT', command=lambda: sys.exit(), 19 width=40, height=40, fg='#ff0000', bg='#FFFF00', 20 font=(u'MS ゴシック', 20, 'bold')) 21 button1.pack() 22 button2.pack() 23 root.mainloop() 24
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/07/13 13:43
2019/07/13 14:23
2019/07/14 11:17