GET VALUE FROM SWING GUI
Hi. I can't get value from swing simple gui to the rest script
I think it must be in a different thread but I can't find any working example
Can you show me a working example??
*im running throw command line the script
My simple code is this:
from javax.swing import (JButton, JFrame, JPanel, JCheckBox, JLabel, BoxLayout,
from java.awt import BorderLayout
myval = 0
#------
class Mytest():
def tally(event):
global myval
if checkbox1.
myval = 2
else:
myval = 3
frame.visible = False
#------
frame = JFrame('Test!', defaultCloseOpe
selectionPanel = JPanel()
selectionPanel
frame.
#------
text = JLabel(
selectionPanel
text = JLabel('hello there')
selectionPanel
checkbox1 = JCheckBox('2', selected = False)
selectionPanel
checkbox2 = JCheckBox('3', selected = False)
selectionPanel
#------
buttonPanel = JPanel()
frame.
button = JButton('ok', actionPerformed = tally)
buttonPanel.
frame.visible = True
print myval
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: