Thursday, February 26, 2009

Busy today

I was going to write a follow on post about electricity metering, but I was too busy today. I coded the GUI for the test system controller using Python/Tkinter, and was stuck for a while trying to figure out how to put a message to the user temporarily over the main display while the system is converting the acquired data to csv format, a process that can take several seconds.

The problem was that the screen doesn't refresh until the callback that starts the process is complete. Eventually I found out how to generate an 'alarm' after a specified delay which can be attached to another callback. So the first callback puts up the message and starts a separate thread that converts the data, then exits to allow the main window to refresh. Then the alarm occurs after about 1 second and the alarm callback blocks until the convert process is complete, then closes the message. Simple!

Are there any better ways? (apart from not using Tkinter)


Post a Comment

Subscribe to Post Comments [Atom]

<< Home