1

I'm trying to import wxPython in my Blender game engine but getting error :

python code (in blender):

import bge
import wx

app = wx.App()

frame = wx.Frame(None, -1, 'frame in blender')
frame.Show()

app.MainLoop()

Error :-

  Traceback (most recent call last):
  File "Text", line 2, in <module>
  ImportError: No module named wx

I googled about this error, but found nothing usefull..

also,i copied wx directory from python's lib installation directory to the blender's lib directory. after that, i got error:-

Traceback (most recent call last):
File "Text", line 2, in <module>
File "C:\Program Files\Blender Foundation\Blender\2.64\python\lib\wx\__init__.py", line 
14, in <module>
import __version__
ImportError: No module named __version__

please, help me!!

system details :-

os: windows 7
blender version : 2.64a
wxPython version : 2.8

2 Answers2

2

That's because Blender delivers a built-in version of the python interpreter.

You can probably solve this working on another way for importing the module.

I should also remind that the Blender Game Engine is extremely old for the biggest part, many OpenGL calls are really really really old and deprecated ( it's based on a fixed pipeline behaviour ), I wouldn't consider the game engine for any "serious" application of any kind. Blender itself is a good application, the game engine it's not.

user1797612
  • 812
  • 6
  • 22
  • yeah, i tried it by appending wxPython's wx module path to the system path(in blender game engine) :- sys.path.append(path_to_d_Python2.7 installation_lib_wx_module) , but a syntax error occurred inside wxPython's standard wx._core.py file , error(at some line) :- raise Application,name (error of comma b/w application and name ) , i think it might be due to version confliction between blender's python and wxPython's python. – user1372771 Nov 14 '12 at 17:36
  • @user1372771 starting from Blender 2.5x the Blender APIs and the Python interpreter bundled with it are only for Python 3.x, Python 2.x was available in the really old versions of Blender like the 2.49. I don't think that you will find a compatible version for Python 2.7, try some Python 3.x modules. – user1797612 Nov 15 '12 at 04:56
0

As stated, this might not be possible/easy. Check out this dialog for a similar problem with Tkinter and you might find some help on your quest, or find why it cannot be done. However note that bgui seems to be an alternative if e.g. you just want a gui with blender game engine.

ntg
  • 12,950
  • 7
  • 74
  • 95