30 Day Countdown

In which I try to figure out a reason to use pickle.

This one is very simple. It is based on both the idea that doing something for 30 days creates (or breaks) a habit and my undying love of check lists.

Since I don't want it to run constantly for the entire 30 days, I need to come up with a way to save state. I've got two options:

Well, I am trying to learn Python so the choice is foregone. Pickle it is, until I run up against the wall. Sprites are not serializable. It just figures. Now I have two new options:

For this, the pain of stupid does not outweigh the pain of doing it right, so the solution is exactly what I would have done to dump out to a text file anyway, but all packed into a binary. Which may not be such a bad thing if I should ever need to send partially filled check lists around a network.

Other Stuff Involved

Now with interactivity! Mouse handlers can be exciting, especially when you didn't have one before.

Commandline arguments. This is a command line script, when it is called you specify the name of whatever you are tracking.

    ./countdown.py "decaffeinate" &
    ./countdown.py "get to bed before 10:30" &
The string becomes the window title and the name of the binary file that stores the data. This means you can have zillions of the little windows, independent little windows, all over the desktop at the same time.

& of course, is for a background process so that the script that calls it can exit.

30 Day Coundown

May 27, 2009