前提・実現したいこと
Python3.7のライブラリ、tkinterを用いたGUIアプリを作りました。そのテストをPyUnitなどで自動化したいと考えています。
そこで、以下のような簡単な例を用いて、自動でエディットボックスに文字列を入力し、ボタンを押し、文字列がクリアされる事が確認できるスクショを取れるテストコードを書きたいです。
お忙しい中、大変恐縮ですが、どうぞ宜しくお願い申し上げます。
該当のソースコード
Python3.7
1import tkinter as tk 2 3root = tk.Tk() 4root.title(u"PyUnitテスト") 5root.geometry("800x1200") 6 7label1 = tk.Label(root, text="入力テスト") 8countRow = 0 9label1.grid(row=countRow) 10countRow += 1 11 12#エントリー 13EditBox = tk.Entry() 14EditBox.grid(row=countRow) 15countRow += 1 16 17Button = tk.Button(text=u'エディットボックスクリア',command = lambda : delete()) 18Button.grid(row=countRow) 19countRow += 1 20 21def delete(): 22 EditBox.delete(0, tk.END) 23 24root.mainloop()
回答1件
あなたの回答
tips
プレビュー