[Tutor] Need Help Modifying a wxPython GUI (scrolling display and logging)
Matt D
md123 at nycap.rr.com
Thu Jun 13 03:23:45 CEST 2013
> There are other ways a script might change the current directory. For
> example, some naive scripts use os.chdir()
>
> But how is it you don't know what the current directory was when the
> code ran? A simply pwd can tell you, if your prompt doesn't already
> reveal it.
>
>
hey i found the logfile. just took a few minutes of looking round. the
file is logged all out of order so i have some work to do on that
formatting issue. if you have a sec can you take a look at my code please?
def update(self, field_values):
# logger code---------------
# first write the CURRENT date/time
self.logfile.write('%s,'%(str(strftime("%Y-%m-%d %H:%M:%S", gmtime()))))
# loop through each of the TextCtrl objects
for k,v in self.fields.items():
# get the value of the current TextCtrl field
f = field_values.get(k, None)
if f:
#output the value with trailing comma
self.logfile.write('%s,'%(str(f)))
self.logfile.write('\n')
#end logger code ----------------
#if the field 'duid' == 'hdu', then clear all the fields
if field_values['duid'] == 'hdu':
self.clear()
#loop through all TextCtrl fields storing the key/value pairs in k, v
for k,v in self.fields.items():
# get the pickle value for this text control
f = field_values.get(k, None)
# if the value is empty then set the new value
if f:
v.SetValue(f)
When i open the .csv file the fields are all out of order. what i want
is have them all in one row beginning with the date/time. and idea?
Thanks!
More information about the Tutor
mailing list