使用したいプログラムのスケルトンがあります。
from tkinter import *
import urllib
import urllib.request
import xml.etree.ElementTree as ET
root = Tk()
def program():
print('Hello')
tex=Text(root)
tex.pack(side='right')
inputfield = Entry(root)
inputfield.pack(side='bottom')
text = inputfield.get()
but = Button(root,text="Enter", command = program)
but.pack(side='bottom')
root.mainloop()
要約すると、プログラムは、テキスト フィールド、入力フィールド、および というボタンを備えた単なるフレームEnter
です。実際にボタンを押さずに、ボタンが呼び出すプログラムを呼び出したい。入力フィールドにテキストを入力Enterし、キーボードを押して関数を呼び出したいです。
それはtkinterを通して可能ですか?