select() question

Asked by rob barlow

I've trying out the select() function and am little confused.

Im trying to have it pop up in part of the script an wait. So user can click return to go back to main selection or exit altogether.

Im guessing /i have it wrong and that its not going do as I want. That select() will sit there until user has made selection. Then it does whatever its told in its options.

Where I want some stuff doing while the popup is there waiting... Not sure if i have made myself clear...

def Ffish():
    items = ("Wait","Return","Exit")
    selected = select("Clicker Heroes Script 0.6", options = items)
    while True:
        # Was expecting it to see if anything selected do else go on
        # items = ("Wait","Return","Exit")
        # selected = select(options = items)
        if selected == items[1]:
            break
        else:
            pass
        if selected == items[2]:
            exit()
        else:
            pass
        #
        a = Env.getMouseLocation()
        if Fish.exists(Pattern("1435578564051.png").similar(0.80)):
            Fish.click(Pattern("1435578564051.png").similar(0.80))
            print("Got One")
            mouseMove(a)
            wait(0.5)
        mouseMove("1435402415929.png")

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Best RaiMan (raimund-hocke) said :
#1

thte select() acts synchronous like popup().

It is displayed and simply waits until the user presses a button.

What you want cannot be done with Sikuli features currently.

Revision history for this message
rob barlow (rob-barlow1970) said :
#2

Thanks RaiMan, that solved my question.

Revision history for this message
rob barlow (rob-barlow1970) said :
#3

I found a work around to what I wanted to do.

Env.addhotkey(Key.ESC,0,Quit) # ESC not used in game
Setings.Dquit = 1

def Quit(event):
    Settings.Dquit =5

then in any function just use

if Settings.Dquit != 1
   break

then i go back to my main where i can pop up the select() stuff. It works too not sure if theres a better way.

Thank you once again for the help an info.