I want “Class A” to hold and not finish looping over all counts and wait for “Class B” to finish using the set of results coming out of “Class A”. “Class B” is a wxPython dialog box which uses variables computed in “Class A” and do some calculations. But “Class A” finishes for loop and opens number of dialog boxes equal to for loop count altogether.
class A(object):
count = 3
for i in range(count):
"""do something""" dlg = B()
class B(object):
"""do something"""
How to hold it during each iteration of for loop to work with wxPython dialog box one-by-one?
Im sorry, you question is not very clear to me, but:
running a loop in a class defining scope is very odd.
The way you have that code written, the loop will be run when the class is defined – i.e. the module imported, NOT when a A instance is created. If you want the loop to run when the instance is created, you’d put it in the init method.
But chances are what you really want is for your loop to be in another method, and then you would create an instance of A, then call the proper method at the right time.
Ans do you really want to create a new instance of B in each iteration of the loop?
If B is a Dialog, then you usually create it, the call its ShowModal() method when you want to show it. ShowModal() will not return until the user closes the dialog.
HTH,
-Chris
···
On Fri, Dec 27, 2013 at 12:02 PM, Ibraheem Khan ibraheem.khan99@gmail.com wrote:
I want “Class A” to hold and not finish looping over all counts and wait for “Class B” to finish using the set of results coming out of “Class A”. “Class B” is a wxPython dialog box which uses variables computed in “Class A” and do some calculations. But “Class A” finishes for loop and opens number of dialog boxes equal to for loop count altogether.
class A(object):
count = 3
for i in range(count):
"""do something""" dlg = B()
class B(object):
"""do something"""
How to hold it during each iteration of for loop to work with wxPython dialog box one-by-one?
–
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 wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
–
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
Are you saying that, in your example, you want to show the same
dialog three times in a row, and have the loop wait for the result
in each iteration? If so, then your class A loop must not only
create the dialog, it must show it and wait for the result:
for i in range(count):
dlg = B()
result = dlg.ShowModal()
···
Ibraheem Khan wrote:
I want "Class A" to hold
and not finish looping over all counts and wait for “Class B”
to finish using the set of results coming out of “Class A”.
“Class B” is a wxPython dialog box which uses variables
computed in “Class A” and do some calculations. But “Class A”
finishes for loop and opens number of dialog boxes equal to
for loop count altogether.
-- Tim Roberts, Providenza & Boekelheide, Inc.
timr@probo.com