Getting PY_VAR1 when i print 'query'

2020-05-05 01:01发布

Im making a simple web srape code and when i try to print a value it gives me something else.

def PeopleSearch():
query = SearchTerm
query = ('what is '+ query)
print str(query)


SearchTerm = StringVar(None)
SearchText = Entry(app, textvariable=SearchTerm)
SearchText.pack()

'SearchTerm' is gotten from a text Box. If i try to print str(query) i get PY_VAR1. And i get PY_VAR1 no matter what i type.

But this only happens when i do it from program containing tkinter module. Without GUI, it prints exactly what i typed in.

What is up? Huh?

1条回答
做个烂人
2楼-- · 2020-05-05 01:43

StringVar is an object which manages the value - to get the value itself you want SearchTerm.get()

查看更多
登录 后发表回答