Sikuli popup timeout

Asked by arminius on 2017-11-18

I was looking around for a popup that will kill itself after about 10 seconds, found this.
"it is out now and in the docs ;-)"

But I can't find it in any of the docs.

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
masuo (masuo-ohara) said : #1

Now, Timed (autoclosing) popups are provided.
See docs.

arminius (arminius75) said : #2

I tried "popup("autoclosed after 3 seconds", 3)"
but it returned with [error] script [ test ] stopped with error in line 12
    [error] TypeError ( popup(): 2nd arg can't be coerced to String )
    [error] --- Traceback --- error source first line: module ( function ) statement 380: Sikuli ( popup ) TypeError: popup(): 2nd arg can't be coerced to String
    [error] --- Traceback --- end --------------

Manfred Hampl (m-hampl) said : #3

I assume the example is wrong.

The parameters for popup are message, title, preset, hidden, timeout, location.

result = popup("autoclosed after 3 seconds",,,,3)

Best masuo (masuo-ohara) said : #4

Please read docs carefully.

These are the possible parameters and their defined sequence:
[message] a declarative text to be shown in the dialog (all methods, default "not set")
[title] the dialog box title (all methods, default "SikuliX")
[preset] a prefilled input text (input, default empty)
[hidden] a boolean value, True/true will show the input text as dots ((input, default False/false)
[timeout] an integer as seconds after that the dialog will autoclose (all methods, default stay open)
[location] a Region object, over which the dialog will be displayed centered (all methods, default screen center) which allows to place the dialog anywhere on the screen. As a convenience you can use Region(x, y) if you want to specify a point. Hence no need to use popAt().

[example with popup]
timeout = 3
location = Region(200,200)

arminius (arminius75) said : #5

Thanks masuo, that solved my question.