class user_management(wx.Panel): def login(self): # Login Function can be later integrated to allow users access to your program username = self.txt_Username.GetValue() self.frame.SetStatusText("Welcome "+username+" to the system!!") test = MyApp(0) test.MainLoop() How can i access the variable username within another class:
class wizard(wx.wizard.Wizard): def on_finished(self, evt): totalscore = self.totalscore print "Final score: %s" % (totalscore) user = "c1021358" db_file="data/data.db" database_already_exists = os.path.exists(db_file) con = sqlite3.connect(db_file) cur = con.cursor() sql = "INSERT INTO scores (username,totalscore,topic) VALUES ('%s','%s','%s')" % (user,totalscore,tag) At the moment the user is static, however I want to make this user variable equal to the username taken from the text field box.
Can anyone tell me how I can do this please?
Thank you