OK. I have discovered where my code is "blocking" but am not certain how to
fix it. Below is the stacktrace after I 'force' the debugger to break:
PyThread_acquire_lock(void * 0x009acff8, int 1) line 295 + 29 bytes
PyEval_RestoreThread(_ts * 0x0094d8d8) line 342 + 14 bytes
wxPyBeginBlockThreads() line 537 + 10 bytes
wxPyClientData::~wxPyClientData() line 379
wxPyClientData::`scalar deleting destructor'(unsigned int 1) + 15 bytes
wxEvtHandler::~wxEvtHandler() line 610 + 33 bytes
wxWindowBase::~wxWindowBase() line 274 + 111 bytes
wxWindow::~wxWindow() line 361 + 8 bytes
wxControlBase::~wxControlBase() + 15 bytes
wxControl::~wxControl() line 57 + 22 bytes
wxButtonBase::~wxButtonBase() + 15 bytes
wxButton::~wxButton() line 131 + 8 bytes
wxButton::`scalar deleting destructor'(unsigned int 1) + 16 bytes
wxWindowBase::DestroyChildren() line 312 + 30 bytes
wxWindow::~wxWindow() line 346
wxPanel::~wxPanel() line 82 + 8 bytes
wxPanel::`scalar deleting destructor'(unsigned int 1) + 16 bytes
wxWindowBase::DestroyChildren() line 312 + 30 bytes
wxWindow::~wxWindow() line 346
wxTopLevelWindowBase::~wxTopLevelWindowBase() + 29 bytes
wxTopLevelWindowMSW::~wxTopLevelWindowMSW() line 387 + 8 bytes
wxTopLevelWindow::~wxTopLevelWindow() + 15 bytes
wxFrameBase::~wxFrameBase() + 15 bytes
wxFrame::~wxFrame() line 143 + 8 bytes
wxembedFrame::~wxembedFrame() line 100 + 11 bytes
wxembedFrame::`scalar deleting destructor'(unsigned int 1) + 37 bytes
wxApp::DeletePendingObjects() line 1275 + 30 bytes
wxApp::OnIdle(wxIdleEvent & {...}) line 1205
wxEvtHandler::SearchEventTable(wxEventTable & {...}, wxEvent & {...}) line
886
wxEvtHandler::ProcessEvent(wxEvent & {...}) line 800 + 19 bytes
wxApp::ProcessIdle() line 1085
wxApp::MainLoop() line 1068 + 28 bytes
wxAppBase::OnRun() line 118 + 18 bytes
wxEntry(void * 0x00400000, void * 0x00000000, char * 0x00132d19, int 1,
unsigned char 1) line 823 + 16 bytes
WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char *
0x00132d19, int 1) line 24 + 50 bytes
WinMainCRTStartup() line 330 + 54 bytes
KERNEL32! 77e97d08()
The panel and buttons are objects that were added inside of the python code.
(see add_panel() function below)
<30 mins later...>
Ok. I created the frame inside of python: "parent_frame = wxFrame( None,
-1, 'Halo' )" and then called add_panel(). The results were still the same.
A lock with the above stack trace.
Does this help the wxPythonEmbedded cause any? It seems to be my only
stumbling block...
jaime
···
-----Original Message-----
From: Wyant, Jaime [mailto:jwyant@sfbcic.com]
Sent: Monday, April 29, 2002 7:58 AM
To: 'wxpython-users@lists.wxwindows.org'
Cc: 'Sebastian Haase'
Subject: RE: [wxPython] wxPython embedded in wxWindows...-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Friday, April 26, 2002 5:36 PM
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxPython] wxPython embedded in wxWindows...I am attempting to embed wxPython inside of a wxWindows
application....
Abbreviated version of my code....
// Inside of wxWindows C++ code ....
create a frame
Py_Initialize()
PyRun_SimpleString( "from wxPython.wx import wxMessageBox\n" )// end code...
My problem is that the wxWindows application does not
terminate when I
exitit. If I don't "import" the wxPython code, then all is well.
Am I overlooking something?
Look at the wx-users archive from the past couple weeks for
a conversation
about this, and identification of some of the issues. The
ball is currently
in my court to try and solve the final step, but I've spent
the past five
days rebuilding my primary development machine...I have applied a patch I found out on usenet. It was
dealing with wxPython
cleaning up after itself.That solved the problem with my program bombing out when I
exited the main
frame. However, I could not construct any windows because
of a weird error:
(paraphrased somewhat): "Error can't find wxCanvasClass".I am no DLL expert but I think that wxPython and wxMSW are
loading separate
instances of wxmsw232d.dll. If I place this code in
helpers.cpp(__wxPreStart):// Bail out if there is already windows created. This
means that the
// toolkit has already been initialized, as in embedding
wxPython in
// a C++ wxWindows app.
if (wxTopLevelWindows.Number() > 0) {
wxApp::RegisterWindowClasses();
return;
}Weird, because wxApp::RegisterWindowClasses() was already
called by the
wxMSW application. If I register the window classes, then I
can construct
wxWindow objects which use a wxFrame derived child as their parent:// Somewhere deep inside of myapp.cpp
pyFrame = wxPyConstructObject( frame, "wxFrame", 0 );
PyDict_SetItemString( dict, "parent_frame", pyFrame );
PyDict_GetItemString( dict, "parent_frame" );Later, I do this:
def add_panel( parent_frame ):
panel = wxPanel( parent_frame, -1 )
panel.SetBackgroundColour( wxRED )
button = wxButton(panel, 1003, "Close Me")
button.SetPosition(wxPoint(15, 15))
add_panel( parent_frame )The above python code works great. I see a red panel (after
I resize, I
forgot to call Layout() ).When the application shuts down, things go awry. IIRC, I
end up in the
message loop, which handles a message that ends up deleting
my wxFrame. The
object is deleted, however the program hangs once the
wxFrame's dtor is
called. It is REALLY weird as I can't "step out" of the
dtor - I just hang.I assume I need to initialize a couple of other things which
I am not aware
of.HTH,
jaime_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users