Make SikuliX's click function easier to use

Made SikuliX's click function easier to use

Problems with the click function

The source code becomes longer when the click function and the sleep function are arranged side by side. https://qiita.com/JINPLAYSGUITAR/items/0fdadac1ebb7e9289f2d

Correspondence

Prepare your own function

Functional overview

--Click the specified image and wait for the specified time --Arguments are images and numbers (seconds) --Judge the presence or absence of an image at the fastest speed --Loop if no image is found --After looping 5 times, return an error and exit

Source code

pricone.py


#Common function
def waitClick(cap, time):
    index = 0
    while 1:
        if exists(cap):
            click(cap)
            sleep(time)
            break
        index = index + 1
        if index == 5:
            print("error")
            click(cap) #Raise an error
            exit()

#How to call
waitClick("1571732207730.png ", 5)

reference

https://sikulix-2014.readthedocs.io/en/latest/region.html#Region.click

end

Recommended Posts

Make SikuliX's click function easier to use
How to make a recursive function
How to use python zip function
Emacs perspective.el workspace is easier to use
Tips to make Python here-documents easier to read
[python] How to use __command__, function explanation
Let's make jupyter lab easy to use
2. Make import easier
Use click to create a sub-sub command --netsted sub-sub command -
[Python] How to use hash function and tuple.
I want to use the activation function Mish
Expand devicetree source include to make it easier to read
Make a function to describe Japanese fonts with OpenCV
How to use Decorator in Django and how to make it
Deploy the management page to production to make maintenance easier.
How to use Python-shell
How to use tf.data
How to use virtualenv
How to use Seaboan
How to use shogun
How to use Pandas 2
How to use Virtualenv
How to use numpy.vectorize
How to use pytest_report_header
Easy to use Flask
Make a function decorator
[Git] I tried to make it easier to understand how to use git stash using a concrete example
How to use partial
How to use Bio.Phylo
How to use SymPy
How to use x-means
How to use WikiExtractor.py
How to use IPython
How to use virtualenv
How to use Matplotlib
How to use iptables
How to use numpy
Reasons to use logarithm
How to use TokyoTechFes2015
How to use venv
How to use dictionary {}
How to use Pyenv
Easy to use SQLite3
How to use list []
How to use python-kabusapi
Python-How to use pyinstaller
How to use OptParse
How to use return
How to use dotenv
How to use pyenv-virtualenv
How to use Go.mod
How to use imutils
How to use import
Start from zero codewars kata Use lambda to return function? !!
Color Python errors (stack traces) to make them easier to understand
Make the display of Python module exceptions easier to understand
You who color the log to make it easier to see
One liner that formats JSON to make it easier to see
I want to make a click macro with pyautogui (desire)
Made icrawler easier to use for machine learning data collection
I want to make a click macro with pyautogui (outlook)