← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #665323]: anyway to make a simple 'status bar' ?

 

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

    Status: Open => Answered

masuo proposed the following answer:
This is an example.

STATUS = "NG"
COUNTER = 0
REFRESHCYCLE = 3
TIMES = 10
CLOSEDIALOG = False
#----------------
def get_BottomLeft_of_SCREEN():
    r = Region(0,0,10,10)
    r.setRect(SCREEN.getBounds())
    BottomLeftRegion = Region(150,r.getH()-100,0,0)
    return BottomLeftRegion
#----------------
def open_dialog(cnt):
    if not CLOSEDIALOG:
        message = "status:%s\ncounter:%d" % (STATUS, COUNTER)
        title = "Status Dialog(%d)" % cnt
        timeout = REFRESHCYCLE
        location = get_BottomLeft_of_SCREEN()
        Do.popup(message, title, timeout, location)
#----------------
def call_open_dialog(name, *args):
    for cnt in range(TIMES):
        open_dialog(cnt)
#----------------
def change_status(event):
    global STATUS
    global COUNTER
    COUNTER = COUNTER + 1
    if STATUS != "OK":
        STATUS = "OK"
    else:
        STATUS = "NG"
#----------------
def close_dialog(event):
    global CLOSEDIALOG
    CLOSEDIALOG = True
#----------------
import thread
thread.start_new_thread(call_open_dialog,("call_open_dialog",""))
Env.addHotkey(Key.RIGHT, KeyModifier.CTRL, change_status)
Env.addHotkey(Key.END, KeyModifier.CTRL, close_dialog)
popup("Click [OK] to stop")

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.