Simulating a button click - dealing with objects/classes/events...

Hi There:

I have a python module abc.py which has numerous class and some class inherting from another classes. The entire file has classes that are connected to each other with objects/instantiation.

The function calls are all based off of GUI button clicks. So, functions get called in abc.py, when buttons are clicked.

I need to write a script which does exactly the same function of button clicking, but without me clicking on the actual GUI - you can imagine it automated.

The issue is, the button on the GUI, when clicked, an event is triggered and the button is associated with a function call “def button_press” which takes (self, event) as parameters.

How would I pass it self and event? I want to use the classes/functions in the module “abc.py” as is and also simulate the button click… Could you give me some pointers on how I could do this?

Thanks!

You can either:
a) Create an appropriate event, fill it with your test data and
call self.(your_test_event), from within your
gui.
b) As above but from outside your gui call, app.topframe…(your_test_event),
c) If your event handler does not use any data from the event
then if you def (self, evt=None) you can do a or
b without creating an event first,
d) you can use any one of the excellent GUI Test tools available

  • some are listed .
    Hope that helps!
    Gadget/Steve
···

On 25/11/13 01:04, kb wrote:

Hi There:

    I have a python module abc.py which has numerous class and some

class inherting from another classes. The entire file has
classes that are connected to each other with
objects/instantiation.

    The function calls are all based off of GUI button clicks. So,

functions get called in abc.py, when buttons are clicked.

    I need to write a script which does exactly the same function of

button clicking, but without me clicking on the actual GUI - you
can imagine it automated.

    The issue is, the button on the GUI, when clicked, an event is

triggered and the button is associated with a function call “def
button_press” which takes (self, event) as parameters.

    How would I pass it self and event? I want to use the

classes/functions in the module “abc.py” as is and also simulate
the button click… Could you give me some pointers on how I
could do this?

    Thanks!

  You received this message because you are subscribed to the Google

Groups “wxPython-users” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to .
For more options, visit .

button_press
button_press
button_press
here

wxpython-users+unsubscribe@googlegroups.com
https://groups.google.com/groups/opt_out