Piet's advice was not quite correct. In your code, "EVT_END_SESSION" will be
called when the class is defined, not when an instance is created. At the
time it is called, "OnExit" has not yet been defined, and no windows will
have yet been created.
You want EVT_END_SESSION to be called during the OnInit function. Move it
just before the "return true", and adjust the indentation appropriately.
And, as Piet said, add a "self" parameter to the "def OnExit".
···
On Mon, 10 Jun 2002 20:21:43 -0700, "John Hopkins" <john@hopkinsit.com> wrote:
class LTApp(wxApp):
def OnInit(self):
frame = ChoiceFrame(NULL, -1, "Welcome! - Log In or Sign up")
frame.Show(true)
self.SetTopWindow(frame)return true
EVT_END_SESSION(OnExit)
def OnExit():
print "I just Exited."
try:
ThisDB = MySQLdb.Connect(host=DBHost, user=DBUser, db=DBName)
Cursor = ThisDB.cursor()
SQLString = "UPDATE activityrecord SET LogOut = NOW() WHERE
LoginID = %s;" % self.LoginID
Cursor.execute(SQLString)
ThisDB.close()
except:
traceback.print_exc()
pass
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.