← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #308933]: How to display an info message on the screen from Sikuli

 

Question #308933 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/308933

    Status: Open => Answered

RaiMan proposed the following answer:
currently SikuliX does not have a feature like a timed message box, that
appears and vanishes without assistance of the user.

With 1.1.1 at least the available dialogs are always on top and can be positioned at will:
http://sikulix-2014.readthedocs.io/en/latest/interaction.html#popups-and-input-dialogs

If this is not suitable for you, you have to script some Java like this:

def magicMessage(text, time, where = getCenter()):
  from javax.swing import JFrame as JF
  from javax.swing import JTextArea as JTA
  from java.awt import Color as JC
  from java.awt import Font as JFONT
  box = JF()
  box.setAlwaysOnTop(True);
  box.setUndecorated(True);
  pane = box.getContentPane()
  msg = JTA(text);
  msg.setEditable(False);
  msg.setBackground(JC.yellow)
  msg.setFont(JFONT("Dialog", JFONT.PLAIN, 18));
  pane.add(msg)
  box.pack()
  box.setLocation(where.x, where.y) # where to show it
  box.setVisible(True) # show message
  wait(time) # wait given time
  box.dispose() # dismiss message

magicMessage("This is my message\nand more\nand even more", 3)

popup("you should have seen a self destroing message")

happy messaging.
about the Java stuff and more possibilities you have to consult the Java docs

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.