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.


Asked by: Rafael827 | Posted: 01-10-2021






Answer 1

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.

Answered by: Blake579 | Posted: 02-11-2021



Answer 2

While wxPython is unavailable for the reasons listed by @Ali, you may want to take a look at wx.NET. You could use IronPython to call these assemblies instead, and it should be cross-platform (I'm assuming that's what you're after, or you would just use WinForms). If all you're looking for is API compatibility, I think you're out of luck :(

Answered by: Steven584 | Posted: 02-11-2021



Similar questions

wxpython - Is IronPython a 100% pure Python variant?

I just downloaded the original Python interpreter from Python's site. I just want to learn this language but to start with, I want to write Windows-based standalone applications that are powered by any RDBMS. I want to bundle it like any typical Windows setup. I searched old posts on SO and found guys suggesting wxPython and py2exe. Apart from that few suggested IronPython since it is powered by .NET. I wan...


windows - Your best library for create GUI with Python (PyQt, PyGTK, wxPython, IronPython, etc)


python - How to configure the import path in Visual Studio IronPython projects

I have built the IronPythonIntegration solution that comes with the Visual Studio 2005 SDK (as explained at http://www.izume.com/2007/10/13/integrating-ironpython-with-visual-studio-2005), and I can now use IronPython projects inside Visual Studio 2005. However, to let a Python file import from the standar...


python - Pros and cons of IronPython and IronPython Studio

We are ready in our company to move everything to Python instead of C#, we are a consulting company and we usually write small projects in C# we don't do huge projects and our work is more based on complex mathematical models not complex software structures. So we believe IronPython is a good platform for us because it provides standard GUI functionality on windows and access to all of .Net libraries. I know Ironp...


python - Has anyone used SciPy with IronPython?

I've been able to use the standard Python modules from IronPython, but I haven't gotten SciPy to work yet. Has anyone been able to use SciPy from IronPython? What did you have to do to make it work? Update: See Numerical computing in IronPython with Ironclad Update: Microsoft is


python - IronPython on ASP.NET MVC

Has anyone tried ASP.NET MVC using IronPython? Having done a lot of Python development recently, it would be nice to continue with the language as I go into a potential ASP.NET MVC project. I'm especially interested in exploiting the dynamic aspects of Python with .NET features such as LINQ and want to know if this will be possible. The other route that may be viable for certain dynamic programming would be C# 4....


python - BOO Vs IronPython

What is the difference between IronPython and BOO? Is there a need for 2 Python-like languages?


ironpython - Python 2.5.2 continued

This is a continuation of my question Python2.5.2 The code i developed is working fine with clr.Addreference(). Now thee problem is I have to load ny script which uses dll developed in .NET to another application.They had used QT for its implementation.There is a Script console in that application.When ii entered 'import clr' ,it was saying 'No module named clr' or 'Cannot import clr'.What shall i do?


.net - IronPython - Convert int to byte array

What is the correct way to get the length of a string in Python, and then convert that int to a byte array? What is the right way to print that to the console for testing?


python - How should I setup the Wing IDE for use with IronPython

Here is a screen where I should point the Wing IDE to my python files. I am using IronPython. Am I assuming correctly that textbox one gets filled with ipy.exe ? (proper path provided) What should be in the rest of the boxes ?


c# - Packaging script source files in IronPython and IronRuby

Does anyone know how to add python and ruby libs as a resource in a dll for deployment? I want to host a script engine in my app, but dont want to have to deploy the entire standard libraries of the respective languages in source files. Is there a simple way to do this so that a require or import statement will find the embedded resources?


python - CPython or IronPython?

Closed. This question is opinion-based. It is not c...






Still can't find your answer? Check out these communities...



PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python



top