So I am trying to create a GUI that shares information between frames (which are set up as classes) and ran into this error, which despite the many hours of googling and trying different things, had no luck solving. Im just trying to create a library which can be written to and read from other classes. I created this test code just to debug the problem so if you want to see my main code let me know, thanks.
class Vars():
global vari
vari = dict(Sifo = False, Username = "", Password = "", Event = "", Time = "")
def GetVars(self, var):
print "1"
return vari.pop(var)
def SendVars(self, var, val):
print"2"
vari[str(var)] = val
class maintest():
def test(self):
yes = raw_input("Yes: ")
if yes == "1":
yes = True
else:
yes = False
self.result(yes)
def result(self, reslt):
if reslt == True:
yes = True
else:
yes = False
Vars.SendVars('yes', yes)
a = maintest()
a.test()
print Vars.GetVars('yes')
Output:
Yes: 1
Traceback (most recent call last):
File "/Users/jacobsifodaskalakis/Documents/LiClipse
Workspace/Test/Test4.py", line 43, in <module>
a.test()
File "/Users/jacobsifodaskalakis/Documents/LiClipse
Workspace/Test/Test4.py", line 31, in test
self.result(yes)
File "/Users/jacobsifodaskalakis/Documents/LiClipse
Workspace/Test/Test4.py", line 40, in result
Vars.SendVars('yes', yes)
TypeError: unbound method SendVars() must be called with Vars
instance as first argument (got str instance instead)