[Tutor] Need Help Modifying a wxPython GUI (scrolling display and logging)
Matt D
md123 at nycap.rr.com
Tue Jun 18 18:45:33 CEST 2013
> Everything Dave Angel said applies.
>
> You can sort the keys by doing and sorting the keys and then logging.
> That should ensure field order.
>
> for k in sorted(self.fields):
> v = self.fields[k]
>
>
> Also note, that unless you do self.logfile.close() it is not guaranteed
> that the data is being written to file. I prefer to use the following
> idiom for Python 2.6+ (might be in 2.5, but not sure offhand when it was added).
>
> with open('filename.txt', 'a') as f:
> # write data
>
>
Thanks!
Now with some experience using this logger i have found that the items,
while they may not be in an ideal order, are nonetheless always in the
same order starting with date/time. In the interest of getting this
thing working ASAP the current ordering is acceptable for now; at some
later time I may try to arrange into some other desired order.
I am testing the 'a' append mode now. hoping this will allow for not
overwriting existing data.
Where in the program do I put the:
self.logfile.close()
Is there someway to trigger this from the UI? or even when the program
is stopped?
More information about the Tutor
mailing list