virtual ~MyApp();
     void Init_wxPython();
 private:
-    PyThreadState* main_tstate;
+    PyThreadState* m_mainTState;
 };
 
 
     // module and sets a pointer to a function table located there.
     wxPyCoreAPI_IMPORT();
 
+    // Ensure that the new classes defined in the wxPython wrappers are
+    // recognised by the wx RTTI system.  (If you don't use wxWindow in
+    // your C++ app you won't need to do this.)
+    wxClassInfo::CleanUpClasses();
+    wxClassInfo::InitializeClasses();
+
     // Save the current Python thread state and release the
     // Global Interpreter Lock.
-    main_tstate = wxPyBeginAllowThreads();
+    m_mainTState = wxPyBeginAllowThreads();
 }
 
 
 MyApp::~MyApp()
 {
     // Restore the thread state and tell Python to cleanup after itself.
-    wxPyEndAllowThreads(main_tstate);
+    wxPyEndAllowThreads(m_mainTState);
     Py_Finalize();
 }