Cause a button to be clicked

Hi,

I'm new to wxPython as of a week or so ago and have a (hopefully) quick question.

I have a username and password box with a 'Check' button underneath. Clicking on the check button validates the user/pass.

I managed to catch the enter event from the textctrl using the EVT_KEY_DOWN event and checking the KeyCode for WXK_RETURN. That part seems to work fine.

The part I can't figure out is how to cause the Check button to be 'clicked' without actually clicking on it. Is there an event I can trigger?

Thanks for any help.

Cheers,
Jonathan

i do not understand why you want the Button to be clicked.
Why not use:
def OnButtonClick(...):
    DoButtonFunc()

On Enter:
    DoButtonFunc()

Does this help?

Thanks for the reply.

Yep, I could do that, but I was also trying to remove the annoying 'bell'
sound when you press enter.

In the 'doButtonFunc()', event.Skip() is called which causes the event to be
skipped and the bell sounded :).

By creating a button press event I was hoping to avoid the bell. I can
achieve the same affect by removing event.Skip() from 'doButtonFunc()', but
I'm pretty sure that is not really the best way to do it. I 'think' the
correct way would be to create a button press event somehow, but I can't see
how, so I'll probably just stick with what I've got unless someone offers an
insight.

Thanks,
Jonathan

OTOH, there is already an event for this, just use give the textctrl the
wxTC_PROCESS_ENTER style and use EVT_TEXT_ENTER to catch the event.

You appear to be correct, although it's wxTE_PROCESS_ENTER not
wxTC_PROCESS_ENTER.

Thanks heaps

Jonathan