Reputation: 129
The following is the functional issue I'm dealing with. While this example doesn't do it, word is being set by a for loop, so I can't just set "dave" with a string. However, if you run it, you can see that "word" is printing "smith" and "dave" is printing "PYVAR0." How can I fix it so "dave" prints "smith"?
from Tkinter import *
import ttk
root = Tk()
word = "smith"
print word
dave = StringVar()
dave.set(word)
print dave
Upvotes: 0
Views: 2163
Reputation:
You need to invoke dave.get
:
print dave.get()
Doing so will return the string value contained in the StringVar
.
Upvotes: 1