I do something like the following every time I create a new top window
(I use them to display files without the user having to close them
before doing more actions in the main program [non-modal, I believe]):
I do something like the following every time I create a new top window
(I use them to display files without the user having to close them
before doing more actions in the main program [non-modal, I believe]):
But I get an exception somewhere I can't seem to trap:
Note the exception (but is it an exception?) I do get:
<mypkg.logtextframe.LogTextFrame; proxy of <Swig Object of type
'wxFrame *' at 0x324cc00> >
This is not an exception, where is the rest of the call stack?
I can't catch that exception!
Does anyone know more about what a proxy is in wxPython terms? Are
thee attributs od methods for it? Does it ever become zero?
This is irrelevant to the issue your (seem) to be describing. When
your Frame's are closed do you call Destroy on them? If not then they
will not be garbage collected because you are still holding a
reference to them in your list.
If your getting a crash that is caused by an exception please post the
exceptions traceback.
Cody
···
On Thu, Aug 19, 2010 at 4:00 PM, Tom Browder <tom.browder@gmail.com> wrote:
On Thu, Aug 19, 2010 at 14:02, Cody Precord <codyprecord@gmail.com> wrote:
BTW, there are a couple things that you may not be aware of that could make it unnecessary for you to do this.
1. If you make the other frames be children of your main frame then they will all be closed automatically when the main frame closes.
2. wx already has a list of all top level windows, so if #1 is not a good fit for you then you can do something like this to close all windows:
for w in wx.GetTopLevelWindows():
w.Close()
···
On 8/19/10 11:59 AM, Tom Browder wrote:
I do something like the following every time I create a new top window
(I use them to display files without the user having to close them
before doing more actions in the main program [non-modal, I believe]):
I do something like the following every time I create a new top window
(I use them to display files without the user having to close them
before doing more actions in the main program [non-modal, I believe]):
Originally did the frame that was giving your a problem have a
wx.Timer object in it that wasn't mytimer.Stop()'d,
or did you have a process or thread holding a reference to some object
in a window you were trying to close?
No, no timer. What I had was several top-level windows in addition to
the main one, each generated to hold stderr and stdout from a
subprocess. Each subprocess wrote its own stdout/stderr to two files
which the main process read (and then closed) and showed the text in
two top-level windows. Note that each subprocess uses the same file
names, but no two subprocesses can run or write files at the same
time.
Top-level windows accumulate from each subprocess and I allow the user
at any time to kill all the non-main top-level windows if desired
without killing the main window.
I probably don't have a clean solution for how to handle that (I get
very confused reading the subprocess module docs), but Robin's
solution did the trick.
Eventually I would like to show the set up in a short demo program for
advice on best practices, but I have to press on now with using my app
as it is.
Regards,
-Tom
···
On Fri, Aug 20, 2010 at 11:02, DevPlayer <devplayer@gmail.com> wrote:
Just curious Tom,
Originally did the frame that was giving your a problem have a
wx.Timer object in it that wasn't mytimer.Stop()'d,
or did you have a process or thread holding a reference to some object
in a window you were trying to close?
I've only barely dabbled in thread coding but I think I've seen others
use Queues for inter thread communication.
Personally, I'd use one thread for each particular limited system
resource or a specific file and that thread talk to other threads
through a read Queue and a write queue. In other words have a
File_thread for reading and writing to a file and post to the Queue on
the reads and popping from the Queue on writes to the file. Other
threads would pop to read from the queue and post to the queue to
write to it. Of course this style is more an event like use of threads
then a multitasking construct.
Using the same idea of one thread controlling the file, perhaps take a
look at pubsub too instead of reading and writing to a queue.
If anyone feels I'm misdirecting OP Tom, let us know, so I may learn
too.
···
On Aug 20, 12:53 pm, Tom Browder <tom.brow...@gmail.com> wrote:
On Fri, Aug 20, 2010 at 11:02, DevPlayer <devpla...@gmail.com> wrote:
> Just curious Tom,
> Originally did the frame that was giving your a problem have a
> wx.Timer object in it that wasn't mytimer.Stop()'d,
> or did you have a process or thread holding a reference to some object
> in a window you were trying to close?
No, no timer. What I had was several top-level windows in addition to
the main one, each generated to hold stderr and stdout from a
subprocess. Each subprocess wrote its own stdout/stderr to two files
which the main process read (and then closed) and showed the text in
two top-level windows. Note that each subprocess uses the same file
names, but no two subprocesses can run or write files at the same
time.
Top-level windows accumulate from each subprocess and I allow the user
at any time to kill all the non-main top-level windows if desired
without killing the main window.
I probably don't have a clean solution for how to handle that (I get
very confused reading the subprocess module docs), but Robin's
solution did the trick.
Eventually I would like to show the set up in a short demo program for
advice on best practices, but I have to press on now with using my app
as it is.
I've only barely dabbled in thread coding but I think I've seen others
use Queues for inter thread communication.
Personally, I'd use one thread for each particular limited system
resource or a specific file and that thread talk to other threads
through a read Queue and a write queue. In other words have a
File_thread for reading and writing to a file and post to the Queue on
Well, I'm not convinced yet that I use more than the main thread plus
one thread for the current subprocess.
Using the same idea of one thread controlling the file, perhaps take a
look at pubsub too instead of reading and writing to a queue.
I have used pubsub but I'm not sure it's needed here.
I guess I need to do some serious debugging to determine what's really
happening.
Thanks, DevPlayer
Regards,
-Tom
···
On Fri, Aug 20, 2010 at 17:42, DevPlayer <devplayer@gmail.com> wrote: