>I would like to write a little program or two for the entertainment of my 18
>month old daughter as she really likes banging around on the keyboard (or
>sometimes playing with the trackball mouse.
>
>Can anybody tell me how to get keyboard input onto the root window to be
>re-directed into the stdin for a shell script, as I want to start up by
>making the screen change colours depending on what key she presses.
>
>Thanks in anticipation

Good idea.

Here's two approaches I can think of...

1. Use curses to read each character without hitting ENTER. Then, run a
system("xsetroot <color>") to switch the root windows color.

2. A much better method would be to use SDL (http://www.libsdl.org). Start the
program in fullscreen and key presses will change the screen color. It should
run much faster with this method and that's all your little girl will see is one
color on the monitor (no window manager stuff). You could even display images
depending on the character input (ex: A=apple, ant) or play sounds. Of course
what would you use for non-character keys (space bar, enter, brackets)?!?

Hey, I really like this idea; so much, that I'm going to write it myself!

Scott



Reply via email to