12

Does anyone know of a Python class similar to Java Robot?

Specifically I would like to perform a screen grab in Ubuntu, and eventually track mouse clicks and keyboard presses (although that's a slightly different question).

Jason Plank
  • 2,336
  • 5
  • 31
  • 40
Stuart K
  • 3,212
  • 4
  • 22
  • 27

4 Answers4

6

If you have GTK, then you can use the gtk.gdk.Display class to do most of the work. It controls the keyboard/mouse pointer grabs a set of gtk.gdk.Screen objects.

Nadia Alramli
  • 111,714
  • 37
  • 173
  • 152
  • Example of use: http://stackoverflow.com/questions/69645/take-a-screenshot-via-a-python-script-linux/782768#782768 – Jamie Jan 21 '16 at 17:41
3

Check out GNU LDTP:

GNU/Linux Desktop Testing Project (GNU LDTP) is aimed at producing high quality test automation framework [...]

Especially Writing LDTP test scripts in Python scripting language

Benji York
  • 2,044
  • 16
  • 20
0

As far as the screen grab, see this answer. That worked for me. Other answers to the same question might be of interest as well.

Community
  • 1
  • 1
Fred Larson
  • 60,987
  • 18
  • 112
  • 174
-1

Check out the RobotFramework. I do not know if it will do the same things as JavaRobot, or if it will do more. But it is easy and very flexible to use.

rsarro
  • 566
  • 3
  • 6