sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #26421
[Question #250327]: [error] mouseDown: buttons still pressed - using all
New question #250327 on Sikuli:
https://answers.launchpad.net/sikuli/+question/250327
This is barely modified example from https://wiki.python.org/jython/SwingExamples#JButton_and_Button_events
Main.py file
from javax.swing import JFrame
from javax.swing import JLabel
from javax.swing import JButton
from java.awt import BorderLayout
from sikuli.Sikuli import *
rest = True
class Window:
def setText(self,event):
wait(2)
click("1402946292490.png")
def __init__(self):
frame = JFrame("Jython Example JButton")
frame.setSize(100, 100)
frame.setLayout(BorderLayout())
self.label = JLabel('Hi ')
frame.add(self.label, BorderLayout.NORTH)
button = JButton('Click Me',actionPerformed=self.setText)
frame.add(button, BorderLayout.SOUTH)
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
frame.setVisible(True)
if __name__ == '__main__':
Window()
in result, when i press button, sikuli is clicking correctly but mouse button stays pressed
log is:
[log] CLICK on L(399,880)@S(0)[0,0 1600x900]
Exception in thread "AWT-EventQueue-0" java.lang.IllegalThreadStateException: Cannot call method from the event dispatcher thread
at java.awt.Robot.checkNotDispatchThread(Unknown Source)
at java.awt.Robot.waitForIdle(Unknown Source)
at org.sikuli.script.RobotDesktop.mouseDown(RobotDesktop.java:76)
at org.sikuli.script.Region._click(Region.java:2320)
at org.sikuli.script.Region.click(Region.java:2198)
at org.sikuli.script.Region.click(Region.java:2181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
at org.python.core.PyObject.__call__(PyObject.java:404)
at org.python.core.PyObject.__call__(PyObject.java:408)
at org.python.core.PyMetho
[error] mouseDown: buttons still pressed - using all
d.__call__(PyMethod.java:124)
at org.python.pycode._pyx128.setText$2(C:\Users\geodetka\AppData\Local\Temp\sikuli-7712143395428788550.py:23)
at org.python.pycode._pyx128.call_function(C:\Users\geodetka\AppData\Local\Temp\sikuli-7712143395428788550.py)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
at org.python.core.PyBaseCode.call(PyBaseCode.java:194)
at org.python.core.PyFunction.__call__(PyFunction.java:387)
at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:220)
at org.python.core.PyMethod.__call__(PyMethod.java:211)
at org.python.core.PyMethod.__call__(PyMethod.java:206)
at org.python.core.PyCompoundCallable.__call__(PyCompoundCallable.java:26)
at org.python.core.PyObject.__call__(PyObject.java:357)
at org.python.core.PyObject._jcallexc(PyObject.java:3502)
at org.python.core.PyObject._jcall(PyObject.java:3534)
at org.python.proxies.java.awt.event.ActionListener.actionPerformed(Unknown Source)
at
javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.
Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Sourc
e)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
sorry for my English
regards Piotr
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.