2
我試圖從一個Tkinter的Entry()
部件得到的值,但它返回str() has no attribute get()
:如何在Python中創建動態變量3
import tkinter
from tkinter import *
root=Tk()
flag=0
a={'x','y','z'} # Consider these as columns in database
for i in a:
i=Entry(root)
i.pack()
def getter():
for i in a:
b=i.get() # i is read as string and not as variable
print(b)
asdf=Button(root,text='Enter',command=getter)
asdf.pack()
root.mainloop()
可能的重複[如何在Python中執行變量變量?](http://stackoverflow.com/questions/1373164/how-do-i-do-variable-variables-in-python) – jonrsharpe
** TL ; DR **:不。 – jonrsharpe