Pregunta

Just having some problems with xdotool here - great program, but unfortunately hasn't been behaving.

from Tkinter import *
import os

class Ed:
 def __init__(self,parent):
    self.button = Button(parent,command=self.passthrough)
    self.button.pack()
    parent.geometry('+100+100')

 def passthrough(self):
     print 'clicked'
     os.popen("""
     window=$(xdotool selectwindow click)
     xdotool mousemove 110 140
     xdotool click --window $window
     """)

root = Tk()
app = Ed(root)
root.mainloop()

The program is supposed to render a window with a button in it. When the button is clicked, the cursor changes and you move the mouse off the window and click on the window behind it (eg GIMP). Then the mouse goes back to over the button, but clicks through to the program behind. However, it is not doing that. Apologies in advance, it is a hard idea to describe.

I would be really greatful for any help you can provide.

Cheers!

¿Fue útil?

Solución

In line "xdotool click --window $window", it must be written as "xdotool click --window $window 1" 1 for the mousebutton to click.

Otros consejos

You can't use popen to run an arbitrary list of commands. popen requires you give it a single command to run.

The documentation for popen is here: http://docs.python.org/2/library/os.html#os.popen

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top