Problem obtaining an object reference...

S

SamG

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.


class Awindow:

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

class Bwindow:
def __init__(self):
<define propertis of Bwindow>


Pls help.
 
T

Terry Reedy

SamG said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top