Sikuli popup timeout

Asked by arminius

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:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
masuo
Solved:
Last query:
Last reply:
Revision history for this message
masuo (masuo-ohara) said :
#1

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

Revision history for this message
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 --------------

Revision history for this message
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)
...

Revision history for this message
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)

Revision history for this message
arminius (arminius75) said :
#5

Thanks masuo, that solved my question.