Hallo buschdel,
bei solchen Sachen schaue ich immer in die wxPython Demo
rein, ob dort schon sowas implementiert ist was ich auch
benötigte und meistens findet man dort auch solchen Sachen.
Du kannst auch eine LogKlasse machen, die in das Textfeld schreibt.
Ich hab mal eine LogKlasse hier, die zwar in ein Logfile schreibt,
aber das kann man ja schnell ändern.
Code: Alles auswählen
from wxPython.wx import *
##
# <br></br>
# class to log all needed info into a file<br></br>
#
# @param logfile path and name of the logfile
# @param parent parent window to show the Error dlg as popup
#
class MyLog(wxPyLog):
def __init__(self, logfile, parent):
wxPyLog.__init__(self)
#self.parent = parent
try:
self.logfile = open(logfile, 'a')
if not (self.logfile):
ShowErrorDlg(self.parent, 'Logfile', 'Could not open logfile\nplease call your administrator')
except:
ShowErrorDlg(self.parent, 'Logfile', 'Could not open logfile\nplease call your administrator')
##########################################################################
##
# <br></br>
# writes the info to the logfile
#
# @param message string to write
#
def DoLogString(self, message, *argv):
#try:
message = getTime() + ": " + str(message)
self.logfile.write(str(message) + '\n')
self.logfile.flush()
#except:
# pass
##########################################################################
##
# <br></br>
# close the logfile
#
def Exit(self):
try:
self.logfile.close()
except:
pass
und so wird das dann implementiert
Code: Alles auswählen
# create new log stream into my logfile
self.log = MyLog(LOGFILE, self.oOptionFrm)
wxLog_SetActiveTarget(self.log)
# send first data into the logfile
wxLogMessage("\tstarting Application")
wxLogMessage("")
wxLogMessage("Client version %s" %VERSION)
wxLogMessage("Current user: %s" %USR)
hoffentlich hilft das weiter
Gruß
Christian