← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #265611]: Can't get PyDev to recognize sikuli import

 

Question #265611 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/265611

    Status: Open => Answered

RaiMan proposed the following answer:
this is the only thing you need if you want to RUN Jython scripts with plain Jython (which is the case in Eclipse/PyDev)
import org.sikuli.basics.SikulixForJython
from sikuli import *

For this only a reference to sikulixapi.jar in the projects PyDev
properties is needed (the rest is done in
org.sikuli.basics.SikulixForJython

If you want to have full code completion, then you should not use undotted functions (commands ;-) like
click()

the reason behind:
This is a convenience, only available with the Sikuli IDE and with the above statements with plain Jython at runtime. This is a dynamic action assigning all these undotted Region methods from the Java level to the "constant" object SCREEN, which also is assigned at runtime as Screen() (meaning Screen(0). 

So these dynamic stuff is not available at the static pre-runtime
situation of code-completion.

you have to do the same as you have to do with Java, where it is recommended to say at the beginning:
scr = Screen() # assign Screen(0) to variable scr

and later:
scr.click()

in all situations, where the Region to use is meant the whole primary
screen.

This should give you code completion.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.