Is there a lib in python which allows automation of keyboard sequences (for want of a better expression 'keyboard emulation') I'm pretty new to python, so please be easy on me if it's a really daft question. :P Thanks.

Ah good old SendKeys. I have written whole programs using this. Its a really great module to use. It is really simple but it has one pitfall in my mind. That is that every time that you use it NumLock is disabled. I know that dosent affect some people because they either dont use the numpad or they have laptops that dont actually have a numpad.

Here is a quick example of Sendkeys:

from SendKeys import SendKeys as sk
import time
sk('{LWIN}')
time.sleep(0.1)
sk('r')
sk('notepad.exe')
sk('{ENTER}')
time.sleep(2)
sk('hello{SPACE}world')

Whoops, forgot to mention that I need the lib for linux :$ Thanks for the tips, though, if I ever return to Windoze they'll make a good starting-point.

xvkbd runs on Linux and SendKeys has a source package, probably a python extension, so it should work but I haven't tried it.

Thanks, woooee, I've had a quick look at xvkbd and suspect that it isn't quite what I need. One of the things I want to do is to pass sections of text to a speech-app (e.g. eSpeak); so, I'll have to spend a bit more time looking at the xvkbd-options. Thanks, once again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.