sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #33807
Re: [Question #197294]: Can Sikuli Methods be Overridden?
Question #197294 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/197294
RaiMan proposed the following answer:
@Ryan
Inheriting from the class Region on the Python level is problematic.
This has historical reasons and is due to the fact, that on the scripting level on can say:
click(someThing)
instead of
someRegion.click(someThing)
this is a convenience, that binds these undotted method usages to the
"constant" object SCREEN at runTime, which is Screen(0).
If you want to do a robust inheritance, then this way:
import org.sikuli.script.Region as JavaRegion
class myComponent(JavaRegion):
pass
this way you are directly using the Java class Region, where all the
methods are implemented.
BTW: I generally do not recommend, to use inheritance, but to implement some wrapper class for your own features.
This way, you have more freedom, to switch between the 2 worlds (yours and SikuliX).
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.