You need to specify the tk.StringVar()
, as you did for every other tk function you specified.
self.variable = tk.StringVar()
This is because you just did an import tk
. As an alternative, you could import just the functions you need, or even all of them, by one of the two following lines:
from tk import StringVar
from tk import *