wxpython deconstruct

来源:互联网 发布:linux scan 编辑:程序博客网 时间:2024/06/03 17:06
Thanks for the suggestion - I did that and indeed FooButton is not seen
at all as a child of Panel.

So perhaps something was wrong in the way I wrote the swig interface file?


Ok, I really should have seen this earlier, it's been a while since I spent a lot of time on Classic though. The issue is that by default instances of classes that have a destructor will be destroyed when the Python proxy object's ref count drops to zero. Since widget objects are owned by their parent window then we don't want that to happen, their destructions should instead be controlled by their parent. Since there wasn't a good way to do that in SWIG when wxPython was starting out I instead chose to just not let it see that there is a destructor in those classes. 

So to fix your problem just comment out the ~FooButton line in your .i file.
0 0
原创粉丝点击