The Code in Answer 1 works, but I think it is not "correct", because the StringVar var isn't used at all.
The "correct" code should initialize the variable with the parent widget, that is
self.var = StringVar(self)
Then you can call self.var.get() and this gives the expected result