sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #08709
Re: [Question #187432]: User Input Choices
Question #187432 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/187432
RaiMan posted a new comment:
This would have to be implemented as a more powerful popup():
# the extended popup() for Sikuli IDE / Jython level
def popup(message = "", title = "Sikuli", buttons = ("OK",)):
import javax.swing.JOptionPane as JOptionPane
return JOptionPane.showOptionDialog(None,
message,
title,
JOptionPane.DEFAULT_OPTION,
JOptionPane.PLAIN_MESSAGE,
None, buttons, buttons[0])
# how it works
options = ("CONTINUE ANYWAY", "STOP EXECUTION")
button = popup("problem") # same as now
if button < 0:
print "User closed dialog"
else:
print "User clicked button: %d"%button
button = popup("problem", "We are testing") # same as now
if button < 0:
print "User closed dialog"
else:
print "User clicked button: %d"%button
button = popup("problem", "We are testing", options) # new: 2 buttons
if button < 0:
print "User closed dialog"
else:
print "User clicked button: %d"%button
button = popup("problem", buttons = options) # new: 2 buttons
if button < 0:
print "User closed dialog"
else:
print "User clicked button: %d"%button
So you might put the def popup() in your code (overwrites the existing one) until it is available in the official release.
Then you only have to delete the def(), since the signature will be the same.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.