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.
    "https://answers.launchpad.net/sikuli/+question/184361"
"it is out now and in the docs ;-)"

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

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
masuo
Solved:
2017-11-18
Last query:
2017-11-18
Last reply:
2017-11-18
masuo (masuo-ohara) said : #1

Now, Timed (autoclosing) popups are provided.
See docs.
http://sikulix-2014.readthedocs.io/en/latest/interaction.html#timedpopups

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.

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

Best masuo (masuo-ohara) said : #4

@arminius
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)
Do.popup("message","title",timeout,location)

arminius (arminius75) said : #5

Thanks masuo, that solved my question.