SamG wrote:
I have two windowing classes A and B.

Inside A's constructor i created an instance B to display its Modal
window. Only on clicking OK/ Closing this modal window do i proceed to
display the A's window.

All that is fine. Now the problem is i would like to write a python
script to test the this GUI app simulating all the events that make
A's window work through my script. No the problem is to get past my
B's window. Which i'm unable to do since the A's instance would any be
created completely if i click OK/Close button on the B's window. Im
unable to simulate that event since i have little idea about how to
get the object reference to B's window? Here is a sample of the code.

How about

class Awindow:

        def __init__(self):
                <doing something>
                <doing something>
                self.showBwindow()
        def showBwindow(self):
                dialog = Bwindow()
                if __debug__: self.dialog = dialog
                dialog.ShowModal()
                if __debug__: del self.dialog
                dialog.Destroy()

From the assert statement doc (3.0, but unchanged):

These equivalences assume that __debug__ and AssertionError refer to the built-in variables with those names. In the current implementation, the built-in variable __debug__ is True under normal circumstances, False when optimization is requested (command line option -O). The current code generator emits no code for an assert statement when optimization is requested at compile time.

I believe the last applies to all 'if __debug__: <suite>' statements, so you can have them not compiled if you wish. Or use your own 'debug' variable to skip them without fussing with the '-O' startup flags and .pyo files (See Using Python/Command line arguments).

Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to