sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #24036
[Question #243573]: trouble with checkbox pop
New question #243573 on Sikuli:
https://answers.launchpad.net/sikuli/+question/243573
hello,
i would like to make a popup that pauses the script and waits for the user to select some checkboxes and then continue the script once the user clicks the ok button. just like input() in sikuli only with some checkboxes instead of a textfield. i coded a popup with some checkboxes, but the script continues running instead of waiting for the user to click ok.
i know this is more of a jython/swing question. so, if it would be ok, can you explain to me to how to take a look at the input() function so i can emulate it?
here is the checkbox class that does not make the script wait for the user to click ok:
'''
a window for selecting checkboxes
'''
from javax.swing import (JButton, JFrame, JPanel, JCheckBox, BoxLayout,
WindowConstants)
from java.awt import BorderLayout
class SelectBoxes(object):
def tally(self, event):
self.boxes= []
if self.checkbox1.isSelected():
self.boxes.append('1')
if self.checkbox2.isSelected():
self.boxes.append('2')
if self.checkbox3.isSelected():
self.boxes.append('3')
if self.checkbox4.isSelected():
self.boxes.append('4')
if self.checkbox5.isSelected():
self.boxes.append('5')
if self.checkbox6.isSelected():
self.boxes.append('6')
if self.checkbox7.isSelected():
self.boxes.append('7')
print self.boxes
self.frame.visible = False
def __init__(self):
self.frame = JFrame('Select boxes',
defaultCloseOperation = WindowConstants.HIDE_ON_CLOSE)
self.selectionPanel = JPanel()
self.selectionPanel.layout=BoxLayout(self.selectionPanel, BoxLayout.Y_AXIS)
self.frame.add(self.selectionPanel)
self.checkbox1 = JCheckBox('1', selected = True)
self.selectionPanel.add(self.checkbox1)
self.checkbox2 = JCheckBox('2', selected = True)
self.selectionPanel.add(self.checkbox2)
self.checkbox3 = JCheckBox('3', selected = False)
self.selectionPanel.add(self.checkbox3)
self.checkbox4 = JCheckBox('4', selected = False)
self.selectionPanel.add(self.checkbox4)
self.checkbox5 = JCheckBox('5', selected = False)
self.selectionPanel.add(self.checkbox5)
self.checkbox6 = JCheckBox('6', selected = False)
self.selectionPanel.add(self.checkbox6)
self.checkbox7 = JCheckBox('7', selected = False)
self.selectionPanel.add(self.checkbox7)
self.buttonPanel = JPanel()
self.frame.add(self.buttonPanel, BorderLayout.SOUTH)
self.button = JButton('ok', actionPerformed = self.tally)
self.buttonPanel.add(self.button)
self.frame.pack()
self.show()
def show(self):
self.frame.visible = True
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.