Hello,
You need to just enter the same amount of args as you would if it was calling the function. For example:
my_app.dispatch_event('on_key_press', k.A, 0)
will press a.
Thank you,

Brandon Keith Biggs <http://www.brandonkeithbiggs.com/>
On 3/14/2015 11:48 AM, Rob wrote:
Hi,

I think the 'on_key_press' is an event for Window, so you need to dispatch it on the window object you want to simulate key presses for. The second argument contains the modifiers like ctrl and alt. So 0 if there is no modifier or a combination of pyglet.window.key.MOD_*

Rob


Op vrijdag 13 maart 2015 22:06:43 UTC+1 schreef Brandon Keith Biggs:

    Hello,
    That looks like it would work, but I can't figure out how it
    works. Here is what my line looks like:
            my_app.dispatch_event('on_key_press', pyglet.window.key.A)

    But that gives me an error. I'm not sure what to put as the second
    argument.
    thank you,

    Brandon Keith Biggs <http://www.brandonkeithbiggs.com/>
    On 3/13/2015 10:26 AM, Rob wrote:
    If it is to test your own code, you could use
    window.dispatch_event(...) to manually trigger the events.

    Rob

    Op donderdag 12 maart 2015 08:45:42 UTC+1 schreef Brandon Keith
    Biggs:

        Hello,
        Is there a way to tell pyglet that there was a key press from
        an automated script through pyglet?
        Or do I need to go to an external library?
        thanks,

-- Brandon Keith Biggs <http://www.brandonkeithbiggs.com/>

-- You received this message because you are subscribed to the
    Google Groups "pyglet-users" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to pyglet-users...@googlegroups.com <javascript:>.
    To post to this group, send email to pyglet...@googlegroups.com
    <javascript:>.
    Visit this group at http://groups.google.com/group/pyglet-users
    <http://groups.google.com/group/pyglet-users>.
    For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.

--
You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscr...@googlegroups.com <mailto:pyglet-users+unsubscr...@googlegroups.com>. To post to this group, send email to pyglet-users@googlegroups.com <mailto:pyglet-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pyglet-users+unsubscr...@googlegroups.com.
To post to this group, send email to pyglet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to