← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #238787]: is it possible to create a combo box from input in sikuli

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Python is not relevant for GUI related stuff, since we are in the Jython/Java environment.
Since Jython does not have any GUI support, we have to step down to the Java level.
In fact input() is internally realized with the respective Java features.

this is a nice blog entry for that:
http://alvinalexander.com/java/joptionpane-showinputdialog-examples

the relevant part for Jython is

String favoritePizza = (String) JOptionPane.showInputDialog(frame, 
        "What is your favorite pizza?",
        "Favorite Pizza",
        JOptionPane.QUESTION_MESSAGE, 
        null, 
        pizzas, 
        pizzas[0]);

to Jythonize this:

import javax.swing.JOptionPane as JOP

pizzas = [ "Cheese", "Pepperoni", "Sausage", "Veggie" ]
val = JOP.showInputDialog(null,  
        "What is your favorite pizza?",
        "Favorite Pizza",
        JOptionPane.QUESTION_MESSAGE, 
        null, 
        pizzas, 
        pizzas[0])

hope it helps ;-)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.