Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use wxPython inside IronPython?

When my IronPython program gets to the line

import wx

I get this message:

A first chance exception of type
'IronPython.Runtime.Exceptions.PythonImportErrorException' occurred in IronPython.dll

Additional information: No module named _core_

although I do have the file wx\_core_.pyd. Also, before attempting the import, I have the lines:

sys.path.append('c:\\Python24\\Lib\\site-packages')
sys.path.append('c:\\Python24\\Lib\\site-packages\\wx-2.6-msw-unicode')
sys.path.append('c:\\Python24\\Lib\\site-packages\\wx-2.6-msw-unicode\\wx')
sys.path.append('c:\\Python24\\Lib\\site-packages\\wx-2.6-msw-unicode\\wx\\lib')
sys.path.append('c:\\Python24\\Lib\\site-packages\\wx-2.6-msw-unicode\\wxpython\\lib')
sys.path.append('c:\\Python24\\Lib\\site-packages\\wxaddons')

which I hoped would let IronPython find everything it needed.

like image 879
Charles Anderson Avatar asked Dec 13 '22 06:12

Charles Anderson


1 Answers

No, this won't work. Wx bindings (like most other "python bindings") are actually compiled against CPython.

In this regards they are not just packages on sys.path to be found, as you have tried. They actually depend on CPython itself. This rather dry document explains the process.

Note: There was a mission by some of the crew at Resolver Systems to allow you to use CPython bindings with IronPython (called IronClad) but this is in its early stages, and I think they will concentrate on getting things like Numpy working first, GUI toolkits will always be the last, and hardest.

like image 164
Ali Afshar Avatar answered Dec 27 '22 10:12

Ali Afshar