Couldn't able to close the popup window through script

Asked by siddu

Hi,

In a script called the popup function to display popup window but i couldn't able to close the popup window through script.
Manually i can close the popup window by ESC or ENTER or ALT+F4 key's or by clicking the OK button on popup window but through script i cant close the popup window with all manual options.

Code:

popup("Script 115 PASSED", "Script 115 INFO")
wait(5)

type(Key.F4, KeyModifier.ALT))
type(Key.ESC)
type(Key.ENTER)
click(ok.png)

Please suggest me a way to close the popup window.

thanks and regards
Siddu

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

with this inline approach, you cannot handle the popup, because the script waits for the completion of the popup function, and hence only continues, if the popup has vanished.

you have to issue the popup in a parallel thread like this (simplest solution):

import thread
thread.start_new_thread(popup,("test",))
wait(2)
type(Key.ESC)

for more information about Python threads/subprocesses consult tutorials and docs in the net.

Revision history for this message
siddu (siddum-meti) said :
#2

Thanks RaiMan, that solved my question.

Revision history for this message
Nikolai Lysenko (zemik69) said :
#3

RaiMan, hello. I need to use unicode. How i can use popup with unicode in thread.start_new_thread? Thanks.