Builing a GUI with Sikuli

Asked by Deses

I want to do a GUI for my script in order to let the user input some options...

I'm want to export from javax.swing and build a very basic gui, but I don't know if it's possible... and I don't want to build everything to then realize that it doesn't work that way.

Or do you suggest something different?

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
RaiMan (raimund-hocke) said :
#1

In a Sikuli script you can use any java/javax classes.

e.g.
import javax.swing.JFrame as JF

frame = JF()
....
frame.pack()
frame.setVisible(true)

same goes for all the other stuff, but it is Python that you have to write.

The other possibility is to write a Java class for the GUI and use it in the script

import myGUI
myGUI.init()
options = myGUI.getOptions() # e.g. in a hash

Revision history for this message
Deses (deses12) said :
#2

I'm going to try to write a class. When I'm finished, I just have to throw the .java file into the same folder where the .py is located, right?

Revision history for this message
Best RaiMan (raimund-hocke) said :
#3

You have to try, when you are ready.
Candidates are:
--- same folder where the .py is located
--- same folder where the .sikuli is located
--- any other location on the java class path (you might add an entry using -cp with the java command in Sikuli-IDE.bat/Sikuli-IDE-w.bat)

Revision history for this message
Deses (deses12) said :
#4

Well, after seeing this http://sikuli.org/docx/faq/030-java-dev.html I decided to port my work from Python to Java. I think that will suit my needs better than just Python...

So, problem solved!

Revision history for this message
Deses (deses12) said :
#5

Thanks RaiMan, that solved my question.

Revision history for this message
RaiMan (raimund-hocke) said :
#6

simply the best ;-)

Revision history for this message
Deses (deses12) said :
#7

Just be aware that that change is going to cost a couple of question more...

I hope I don't bother you a lot! >.<

Revision history for this message
RaiMan (raimund-hocke) said :
#8

Always welcome.