Possibility and Probability

Coding Python and making businesses…

1 June 2004

Tip of the day

by Nick

Looking for an example of how to do something in Python? Check out the Demo directory (note the capitalization) in your Python installation. In there you will find all kinds of neat demos. I discovered them after running into roadblocks with google. I was flipping through “The complete Python reference” when I stumbled across the chapter that mentions the python Demo directory. A few quick minutes later and I was playing with the curses examples. If anyone is interested, I was trying to find out how python can handle keyboard input in a way similar to C/C++’s getchar() function. Apparently curses (or ncurses) is the best/only way to do that. Which is probably for the best, using curses for my output on my current project will probably be much better than the print statements I’ve been using so far… It just goes to show you that sometimes it pays to read the documentation. There are also Tk examples in that Demo directory and a few months ago I was looking for that very thing and had to search high and low on the net. And all that time it was sitting there on my hard drive.

tags: