sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #07366
Re: [Question #180478]: Difference between Java Approach and Python Approach
Question #180478 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/180478
Status: Open => Answered
RaiMan proposed the following answer:
When running a Sikuli script (Python language) in Jython interpreter (or
with the means of Sikuli IDE), you can import and use all Java classes,
found in the class path.
--- differences to plain Java code
- no variable declarations needed
- no trailing ; needed
- creating an instance just by saying
someObject = SomeJavaClass()
creates a new instance of java class SomeJavaClass
So just import the needed class and start coding according to the
documented Java API.
example:
--- taking a screenshot and write it to an image file
from java.awt import *
from java.io import File
from javax.imageio import ImageIO
robot = Robot()
theImage = robot.createScreenCapture(Rectangle(Toolkit.getDefaultToolkit().getScreenSize()))
ImageIO.write(theImage, "png", File(r"C:\myPic.png"))
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.