求助大神,請問tkinter怎么獲取 多行文本框(Text)內容

root = Tk()
root.title("單詞查詢")
root.geometry("550x350")
e=StringVar()
enter_eng = Text(root, textvariable=e, width=55, height=22)
enter_eng.pack()
root.mainloop()
Traceback (most recent call last):
File "D:/python存檔/PycharmProgram/eng_lean1/main_lean.py", line 69, in <module>
enter_eng = Text(root, textvariable=e, width=55, height=22)
File "D:\python3.7.0\lib\tkinter\__init__.py", line 3098, in __init__
Widget.__init__(self, master, 'text', cnf, kw)
File "D:\python3.7.0\lib\tkinter\__init__.py", line 2296, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: unknown option "-textvariable"
用get()也會報錯
我是新手請,
大佬幫忙
uj5u.com熱心網友回復:
Text 貌似沒有 textvariable獲取值用get
print(enter_eng.get(1.0,'end'))
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/10191.html
上一篇:UnboundLocalError: local variable 'outmid0' referenced before assignment報錯問題
