← Back to team overview

sikuli-driver team mailing list archive

[Question #250468]: How to instantiate a SikuliEvent object

 

New question #250468 on Sikuli:
https://answers.launchpad.net/sikuli/+question/250468

I am setting a hot key to stop my scripts with the following:
Env.addHotkey(key.F12, KeyModifier.CTRL, self.breakscript)

And my breakscript definition:

def breakscript(self, event):
    App.focus("ArcMap")
    click(self.inside_sitmap)
    wheel(self.inside_sitmap, WHEEL_DOWN, 1)
    exit(1)

This code works great and I use it all the time to stop my scripts and have it return my ArcMap to the correct zoom level.  But what if I wanted to call breakscript from anywhere else?  I would need to create a SikuliEvent object to pass to it as "event".  I've tried a couple ways to instantiate that object, but the compiler just keeps telling me that "AttributeError: 'module' object has no attribute: 'SikuliEvent'"  or "NameError: global name 'SikuliEvent' is not defined".  I have the following import at the top of my file:

from sikuli import *

So, is it possible to manually create an event object outside of a addHotKey or some kind of onAppear procedure?  What is the correct syntax for doing so?

Thanks,

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