[sikuli]-sikuli与用户的交互

 

popup ( text [title ] )

Display a dialog box with an OK button and text as the message. The script then waits for the user to click the OK button.

Parameters:
  • text – text to be displayed as message
  • title – optional title for the messagebox

Example:

popup("Hello World!\nHave fun with Sikuli!")

A dialog box that looks like below will popup (Note: n can break a line).

input ( [ text ] [default ] )

Display a dialog box with an input field, a Cancel button, and an OK button. The optional text can be displayed as a caption. The script then waits for the user to click either the Cancel or the OK button.

Parameters: Returns:
  • text – optional text to be displayed as message
  • default – optional preset text for the input field (new in later then X-1.0rc3)

 

the text, contained in the input field, when the user clicked OK

None, if the user pressed the Cancel button

 

Example:

name = input("Please enter your name to log in:")

name = input("Please enter your name to log in:", "anonymous") # a preset input text

A dialog box that looks like above will appear to allow the user to interactively enter some text. This text is then assigned to the variable name, which can be used in other parts of the script, such as paste(name) to paste the text to a login box.

When using the parameter default, the text input field will be pre-populated with the given text, so the user might just click OK/Cancel or edit the content of the input field.

 

你可能感兴趣的:(sikuli)