anyway to make a simple 'status bar' ?

Asked by cherie on 2018-03-06

like draw a small white box maybe on the buttom left of the screen, where it pulls the data from variables :)

[ Status: ON ]
[ Counter: 3]
[ Time: ]

etc ? :)

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
masuo
Solved:
2018-03-07
Last query:
2018-03-07
Last reply:
2018-03-07
Best masuo (masuo-ohara) said : #1

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")

cherie (cherieann) said : #2

Thank you! Tho the closing just keeps running hehe until 10.. i can work with it tho

thanks a lot!

cherie (cherieann) said : #3

Thanks masuo, that solved my question.