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()
如何访问在另一个类中的变量名:访问变量类下的蟒蛇
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)
目前的用户是静态的,但我想使这个用户变量等于从文本框中获取的用户名。
任何人都可以告诉我怎么做到这一点吗?
谢谢
@Jeff 请您详细说明如何创建对象。我会尝试使用全局变量 - 但老实说,我已经尝试过。这里是代码,我知道它的代码非常糟糕,非常混乱 - 但请尽量阅读它。 谢谢 – viperfx 2011-03-23 23:07:56
得到它的工作,谢谢! – viperfx 2011-03-23 23:27:24