【发布时间】:2015-07-28 21:08:05
【问题描述】:
1) 我收到myText_Box 的属性错误
2) 我的目标是通过文本框接受用户输入,然后通过 API 定义方法定义单词。
3) 我将利用这个post 来请求一个字符串——我解决属性错误有多冷?在此post 之后,我正在尝试与calc.myText_Box 类似的东西
calc = tk.Tk()
calc.title("VocabU")
Question_1 = str("Define which word?")
FRONT_PAGE = ['Define me!', Question_1]
def retrieve_input():
input = calc.myText_Box.get("1.0",'end-1c')
define_me = dictionary.get_definition(input)
return define_me
USER_INP = retrieve_input()
#RESPONSE = str(dictionary.get_definition(input))
# set up GUI
row = 1
col = 0
for i in FRONT_PAGE:
button_style = 'raised'
#action =
action = lambda x = retrieve_input(): click_event(x)
tk.Button(calc, text = i, width = 17, height = 3, relief = button_style, command = action).grid(row = row, column = col, sticky = 'nesw')
col += 1
if col > 0: # if col > 4
col = 0
row += 1
display = tk.Entry(calc, width = 40, bg = "white", text = Question_1)
#display.pack
display.grid(row = 2, column = 0, columnspan = 1) # columnspan = 5
【问题讨论】:
-
发布整个错误。
标签: python python-2.7 tkinter attributes