How to generate keyboard keypress events through Python to control PP presentation?
Here is a link for how to handle key press with PyQt - http://www.saltycrane.com/blog/2008/01/how-to-capture-tab-key-press-event-with/
and for wxPython - http://www.wxpython.org/docs/api/wx.KeyEvent-class.html and http://zetcode.com/wxpython/events/
AJJ
Updated on June 04, 2022Comments
-
AJJ about 2 years
I need to programmatically control powerpoint/pdf presentations (the 4 direction keystrokes need to work at the minimum to go to the previous and next slides).
What library/module/framework can I use with Python to do this on OS X?
I've seen a lot of discussion on doing this in Windows and C# (or OS X and Quartz), but nothing particularly with Python. A cross-platform library / framework would be even better.
Overall, I would like to programmatically control my presentation with Python on OS X (as part of a hobby project, and probably also useful in my own short presentations).
-
AJJ almost 13 yearsThanks, but aren't these modules for collecting keypress events? Please let me know if I am wrong. I want to generate events, so as to move the presentation to the next slide, through code.
-
AJJ almost 13 yearsJust to clarify, e.g., I want to move to the next slide after a timer of 1 minute runs down. So I want to write a command that generates the 'forward key' event on the presentation window after 1 minute.
-
arunkumar almost 13 yearsSorry I assumed you were creating the presentation program in Python. One suggestion and I know this is not in Python, but have you looked at AppleScript ? As for a cross platform Python library to send keyboard events to the operating system , the only thing I came across is this using wxPython - wxpython-users.1045709.n5.nabble.com/…
-
AJJ almost 13 yearsThanks! Applescript looks promising. Seems like there isn't a good way to achieve this with Python itself.
-
arunkumar almost 13 yearsI doubt if there is a cross platform library for doing things like this. wxPython, Qt and similar GUI libraries probably have features like this but aren't built really for this purpose. You could use OS dependent libraries such as pyobjc.sourceforge.net for OS X and python.net/crew/skippy/win32 for Win32, but this would fall under slightly advanced programming.
-
Ned Deily almost 13 years
py-appscript
lets you do Applescripting in Python: appscript.sourceforge.net/py-appscript/index.html -
AJJ almost 13 yearsThanks, that bridge should be very useful!
-
Sal about 4 yearsWould this be able to work with an inactive/minimized window?