Forum Archive

How to install wxPython?

HungryGuy

Pretty new to Python, and Pythonista so there is a lot that I don't know. I installed StaSh and pip and installed wxpython using pip. However, when I try to import wx I get an error:

>>>import wx
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/mobile/Containers/Shared/AppGroup/41999424-C8C1-4E26-9BDF-88B75C5BAFEA/Pythonista3/Documents/site-packages/wx/__init__.py", line 18, in <module>
    from wx.core import *
  File "/private/var/mobile/Containers/Shared/AppGroup/41999424-C8C1-4E26-9BDF-88B75C5BAFEA/Pythonista3/Documents/site-packages/wx/core.py", line 12, in <module>
    from ._core import *
ImportError: No module named _core

Is it possible to get wx working? From what I've read, Pythonista isn't able to use modules with C code and it sounds like wxPython is based off of some C code. However, this FAQ (http://omz-software.com/pythonista/docs/faq/gui.html#wxwidgets) mentions wxPython in a way that implies wxPython can be used in Pythonista. Anyway, I'm not sure if I've installed this incorrectly or if it simply is not possible to use in Pythonista at the moment.

JonB

That faq is from the standard library -- nothing on that list works in pythonista! Your gui options in pythonista are basically ui, which is a high level wrapper of some native ios ui, objc_util to directly implement very low level control, or javascript/html inside a webview ( which would let you yse one of the various js/html libraries).

HungryGuy

Well that's disappointing. The project I'm working on is in PsychoPy and its ui seems to be based on wxPython. I was really hoping this was a matter of me messing up the install somehow!

AtomBombed

Yeah, the ui module has more of what you're looking for. You cannot use wxPython as it uses (I believe) C code and other libraries from languages that Pythonista cannot interpret. Basically, wxPython is a desktop-only library. But again: you can use the ui module, and you can create vanilla iOS applications.