当前位置: 首页>编程语言>正文

一段可运行的sikulix代码

from javax.swing import JButton, JFrame

frame = JFrame('Sikulix use Jython code',

            defaultCloseOperation = JFrame.EXIT_ON_CLOSE,

            size = (300, 300)

        )

def my_simple_function():

    print 'This is a really basic function'

def change_text(event):

    my_simple_function()

button = JButton('Click Me!', actionPerformed=change_text)

frame.add(button)

frame.visible = True

#####

#http://doc.sikuli.org/tutorials/surveillance/surveillance.html 小白入门

#count = 0

#while count<10:

#  count = count+1

#  print "count = ",count

#print "Good Bye!"

#count = 1

#while count:

#    wait(5)

#    if exists("1687015836099.png"):#签到

#        click("1687015836099.png")

#    elif exists("1687052611891.png"):#确定

#        click("1687052611891.png")

#    elif exists("1687052611891.png"):#重播

#        click("1687052611891.png")

#    else:

#        print "没找到图片,继续循环"

#def myHandler(event): # you can choose any valid function name

#        # event: can be any variable name, it references the SikuliEvent object

#      #  pass # add your statements here

#      popup("asdf")

#onAppear("1687048102145.png", myHandler) # or any other onEvent()

#observe(10) # observes for 10 seconds

#while true:

#    if find("1687015836099.png"):

#        click("1687015836099.png")

#    elif find("1687015836099.png"):

#        click("1687015836099.png")

#    else:

#        print "ok"

#wait("1687015836099.png", 10)

#click("1687015836099.png")

#for n in range(10):

#    find("1687014738313.png")

#    wait(2)

#    click("1687014738313.png")

#for n in range(10):

# if exists("1687015232583.png"):

#        SD = find("1687015232583.png")

#      click(SD)


https://www.xamrdz.com/lan/5xa2016619.html

相关文章: