[wxPython-users] glcanvas import error

186 views
Skip to first unread message

Wonjun, Choi

unread,
Jan 13, 2012, 3:45:23 AM1/13/12
to wxPython-users
hello,
I have tested below example.
http://code.activestate.com/recipes/325392-use-wxpythonopengl-to-draw-a-sphere/

but I got this error on wxPython2.9.3.1 version
Traceback (most recent call last):
File "/usr/local/src/eclipse_1.4/plugins/
org.python.pydev.debug_2.3.0.2011121518/pysrc/pydevd.py", line 1307,
in <module>
debugger.run(setup['file'], None, None)
File "/usr/local/src/eclipse_1.4/plugins/
org.python.pydev.debug_2.3.0.2011121518/pysrc/pydevd.py", line 1060,
in run
pydev_imports.execfile(file, globals, locals) #execute the script
File "/home/choiwonjun/workspace/wxPython/PENOLA_20120106/test/
wx_example/test6.py", line 7, in <module>
from wx import *
File "/usr/local/lib/python2.7/dist-packages/wx-2.9.3-gtk2/wx/
glcanvas.py", line 8, in <module>
import _glcanvas
ImportError: /usr/local/lib/python2.7/dist-packages/wx-2.9.3-gtk2/wx/
_glcanvas.so: undefined symbol: _ZTI14wxEventFunctor

after I switch like this:

WXVER = '2.9'
import wxversion
wxversion.select(WXVER)

import wx

from wx import *
from wx.glcanvas import wxGLCanvas
from wxPython.wx import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from OpenGL.GL import *
import sys,math

Wonjun, Choi

최원준

unread,
Jan 16, 2012, 3:13:50 AM1/16/12
to wxPython-users
does anyone know how to run this demo?

Gadget/Steve

unread,
Jan 16, 2012, 3:30:49 AM1/16/12
to wxpytho...@googlegroups.com
On 13/01/2012 8:45 AM, Wonjun, Choi wrote:
> import wx
>
> from wx import *
> from wx.glcanvas import wxGLCanvas
> from wxPython.wx import *
> from OpenGL.GLUT import *
> from OpenGL.GLU import *
> from OpenGL.GL import *
> import sys,math
>
> Wonjun, Choi
>
A general comment for you that may, or may not, have a bearing on your
problem, the above is VERY bad practice, in general you should try to
avoid the from package import * and are asking for problems if you use
it more than once in any given module, this is because you are avoiding
using namespaces which means that if the various packages that you are
importing everything from without the package name qualifier have
objects or methods with the same names then the last one imported will
take the place of the other(s). If you find that you are having to do
too much typing then you are better off using the import package as
shortname syntax so that all of your imported classes and methods are
name qualified. The double import of wx both as name qualified and as
an unqualified is especially horrible and probably nearly doubles your
start-up time.

It makes for much more readable code and less error prone code to always
use external packages from within a namespace.

Gadget/Steve

Toni Ruža

unread,
Jan 16, 2012, 3:55:30 AM1/16/12
to wxpytho...@googlegroups.com
On Mon, 16 Jan 2012 09:13:50 +0100, 최원준 <wonjun...@gmail.com> wrote:

> does anyone know how to run this demo?
>

That demo is very old, and it uses mixed spaces and tabs for indentation... instead of fixing it I salvaged the relevant OpenGL parts and used them with my glutton library.

I have attached the result and you can get glutton from https://bitbucket.org/raz/glutton

sphere.py

Robin Dunn

unread,
Jan 16, 2012, 6:20:01 PM1/16/12
to wxpytho...@googlegroups.com
On 1/13/12 12:45 AM, Wonjun, Choi wrote:

> import _glcanvas
> ImportError: /usr/local/lib/python2.7/dist-packages/wx-2.9.3-gtk2/wx/
> _glcanvas.so: undefined symbol: _ZTI14wxEventFunctor

Things like this usually mean that the wx that was used at compile time
(C++ headers and libraries) is not the same one being used (via the
dynamic linker) at run time.


--
Robin Dunn
Software Craftsman
http://wxPython.org

최원준

unread,
Jan 16, 2012, 6:57:12 PM1/16/12
to wxpytho...@googlegroups.com
there is also error though I use glutton module.


  File "/home/workspace/wxPython/test/sphere.py", line 7, in <module>
    from glutton import canvas, presets
  File "/home/workspace/wxPython/test/glutton/canvas.py", line 32, in <module>
    import wx.glcanvas
  File "/usr/local/lib/python2.7/dist-packages/wx/glcanvas.py", line 8, in <module>
    import _glcanvas
ImportError: /usr/local/lib/python2.7/dist-packages/wx/_glcanvas.so: undefined symbol: _ZTI14wxEventFunctor


Toni Ruža

unread,
Jan 17, 2012, 1:26:03 AM1/17/12
to wxpytho...@googlegroups.com

glutton uses glcanvas, so you get the same error as before when you failed to import it.

Am I right to assume that you are trying to use wx binaries you compiled yourself? If so you probably didn't do something right there, or as Robin suggested you have some other wx binaries that are somehow getting in the way.

최원준

unread,
Jan 17, 2012, 1:45:05 AM1/17/12
to wxpytho...@googlegroups.com
I am trying to use opengl in wxPython. so I found some example from above website and I got the error.

Chris Barker

unread,
Jan 17, 2012, 6:14:16 PM1/17/12
to wxpytho...@googlegroups.com
On Mon, Jan 16, 2012 at 12:55 AM, Toni Ruža <gmr...@gmail.com> wrote:
> you can get glutton from
> https://bitbucket.org/raz/glutton

Hey! -- This looks very cool. Do you have a written description of it
anywhere? intent, use case examples, etc? At a glance, it kind of
looks like an OpenGL version of FloatCanvas -- which would be very
nice.

-Chris

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris....@noaa.gov

Toni Ruža

unread,
Jan 18, 2012, 1:54:33 AM1/18/12
to wxpytho...@googlegroups.com
On Wed, 18 Jan 2012 00:14:16 +0100, Chris Barker <chris....@noaa.gov> wrote:

> On Mon, Jan 16, 2012 at 12:55 AM, Toni Ruža <gmr...@gmail.com> wrote:
>> you can get glutton from
>> https://bitbucket.org/raz/glutton
>
> Hey! -- This looks very cool.

Thanks, I'm glad you like it.


> Do you have a written description of it
> anywhere? intent, use case examples, etc? At a glance, it kind of
> looks like an OpenGL version of FloatCanvas -- which would be very
> nice.

It was recently born out of my refactoring a mapping application I am making for a client and a desire to test out a particular initialization method idea (see how the Canvas mixins are initialized if you are interested).

It is usable as it is for it's basic purpose but many of the things I imagined for it are still missing. The most important of which are classes for managing the contents of a vbo, interruptible rendering, efficient ttf glyph renderer, tiled raster backgrounds, classes for basic shapes and a layered 2d scene graph. And of course, if it were to compete with FloatCanvas some coordinate system transformation code should be in there too.

There is no documentation yet, only the few use case examples (the test_* files). If you feel like playing with it I would be glad to answer questions and discuss the implementation.


Toni

최원준

unread,
Jan 18, 2012, 8:19:33 PM1/18/12
to wxpytho...@googlegroups.com
I got this error any idea about this?

import wxeventbinder
ImportError: No module named wxeventbinder

Toni Ruža

unread,
Jan 19, 2012, 1:28:16 AM1/19/12
to wxpytho...@googlegroups.com

It's included in the glutton repository or you can get it from https://bitbucket.org/raz/wxeventbinder

최원준

unread,
Jan 19, 2012, 3:00:56 AM1/19/12
to wxpytho...@googlegroups.com
can I run this in wx2.9 version? I could run this in wx2.8 version but wx2.9.

Toni Ruža

unread,
Jan 19, 2012, 3:47:13 AM1/19/12
to wxpytho...@googlegroups.com
On Thu, 19 Jan 2012 09:00:56 +0100, 최원준 <wonjun...@gmail.com> wrote:

> can I run this in wx2.9 version? I could run this in wx2.8 version but
> wx2.9.
>

2.9 was used to make it. It should also work with 2.8 but I didn't test it.

최원준

unread,
Jan 19, 2012, 3:50:25 AM1/19/12
to wxpytho...@googlegroups.com
I got this error in 2.9

    import _glcanvas
ImportError: /usr/local/lib/python2.7/dist-packages/wx-2.9.3-gtk2/wx/_glcanvas.so: undefined symbol: _ZTI14wxEventFunctor


Tim Roberts

unread,
Jan 19, 2012, 2:24:56 PM1/19/12
to wxpytho...@googlegroups.com
I notice this is in /usr/local/lib.  Is it possible you have multiple Python installations on your disk, and they are getting confused?

That name is the typinfo entry for wxEventFunctor, and is present in libwx_baseu-2.9.so.  Why don't you double-check that all of the libwx files are present where you expect?
-- 
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Chris Barker

unread,
Jan 19, 2012, 3:20:56 PM1/19/12
to wxpytho...@googlegroups.com
On Tue, Jan 17, 2012 at 10:54 PM, Toni Ruža <gmr...@gmail.com> wrote:
>>> you can get glutton from
>>> https://bitbucket.org/raz/glutton

> Thanks, I'm glad you like it.

> It was recently born out of my refactoring a mapping application I am making


> for a client and a desire to test out a particular initialization method
> idea (see how the Canvas mixins are initialized if you are interested).

Mapping? you're kidding! We're working on a wxPython/ PyOpenGL based
mapping lib/application as well -- we really should talk. It's in a
bit of a mess now, but here is an older version:

https://bitbucket.org/dhelfman/maproom/wiki/Home


> It is usable as it is for it's basic purpose but many of the things I
> imagined for it are still missing. The most important of which are classes
> for managing the contents of a vbo, interruptible rendering, efficient ttf
> glyph renderer, tiled raster backgrounds, classes for basic shapes and a
> layered 2d scene graph.

All nice stuff to have, of course!

> And of course, if it were to compete with
> FloatCanvas some coordinate system transformation code should be in there
> too.

There is nothing now? How do you do mapping without any coordinate
transformation?

Anyway, the stuff is FloatCanvas is a bit too limited anyway. In
MapRoom, we are using pyproj for full map projection suport, and
GDAL/OGR for geo-spatial data set support.

We do have a tiled mapp implementation there, though it only points to
tiles that are self-generated so far.

> There is no documentation yet, only the few use case examples (the test_*
> files). If you feel like playing with it I would be glad to answer questions
> and discuss the implementation.

I'll try to take a look, yes. There could be a great opportunity for
collaboration here.

Toni Ruža

unread,
Jan 19, 2012, 4:43:48 PM1/19/12
to wxpytho...@googlegroups.com
On Thu, 19 Jan 2012 21:20:56 +0100, Chris Barker <chris....@noaa.gov> wrote:

> Mapping? you're kidding! We're working on a wxPython/ PyOpenGL based
> mapping lib/application as well -- we really should talk. It's in a
> bit of a mess now, but here is an older version:
>
> https://bitbucket.org/dhelfman/maproom/wiki/Home

As it happens I just stumbled on to this recently and glanced at what it does and how it does it.

Didn't make it run though, just browsed the code a bit and made a mental note to come back to it someday.


>> It is usable as it is for it's basic purpose but many of the things I
>> imagined for it are still missing. The most important of which are classes
>> for managing the contents of a vbo, interruptible rendering, efficient ttf
>> glyph renderer, tiled raster backgrounds, classes for basic shapes and a
>> layered 2d scene graph.
>
> All nice stuff to have, of course!
>
>> And of course, if it were to compete with
>> FloatCanvas some coordinate system transformation code should be in there
>> too.
>
> There is nothing now? How do you do mapping without any coordinate
> transformation?

It's for land surveyors, the areas are small and they work in a state mandated Cartesian-like system. I'm just offsetting coordinates to avoid huge numbers that would mess with OpenGL's 32 bit float accuracy. Coordinates they use look like this:

D150 7466823.174 4958088.962 -2.371
D151 7466826.289 4958085.884 -2.230
D152 7466828.345 4958084.652 -2.111

Units are in meters and the first few digits of x and y have some special meaning about the placement of the coordinate system on the earth.


> Anyway, the stuff is FloatCanvas is a bit too limited anyway. In
> MapRoom, we are using pyproj for full map projection suport, and
> GDAL/OGR for geo-spatial data set support.

Just found out about pyproj recently, I will almost certainly want to use it too.


> We do have a tiled mapp implementation there, though it only points to
> tiles that are self-generated so far.
>
>> There is no documentation yet, only the few use case examples (the test_*
>> files). If you feel like playing with it I would be glad to answer questions
>> and discuss the implementation.
>
> I'll try to take a look, yes. There could be a great opportunity for
> collaboration here.

The projects are similar yet it seems we focused on different areas. The things I focused on are largely connected to making nice COGO automations and UI, easy print layout and dynamically generating the shape geometry based on the scale of the map, shape attributes and a topographic key.

It's a bit of a one-man-army situation here and I wouldn't mind collaboration at all... :)

Hopefully we can merge our efforts into something that is closer to the ambitious end result.


Toni

최원준

unread,
Jan 19, 2012, 7:16:17 PM1/19/12
to wxpytho...@googlegroups.com
>I notice this is in /usr/local/lib.  Is it possible you have multiple Python installations on your disk, and they are getting confused?

>That name is the typinfo entry for wxEventFunctor, and is present in libwx_baseu-2.9.so.  Why don't you double-check that all of the libwx files >are present where you expect?

/usr/local/lib/libwx_baseu-2.9.so
/usr/local/lib/libwx_baseu-2.9.so.2
/usr/local/lib/libwx_baseu-2.9.so.2.0.0
/usr/local/lib/libwx_baseu-2.9.so.3
/usr/local/lib/libwx_baseu-2.9.so.3.0.0

/usr/local/lib/python3.2
/usr/lib/python2.7

최원준

unread,
Jan 19, 2012, 7:27:55 PM1/19/12
to wxpytho...@googlegroups.com
I can switch python version by #!/usr/bin/env python3 or 2

Tim Roberts

unread,
Jan 20, 2012, 1:30:10 PM1/20/12
to wxpytho...@googlegroups.com
So, clearly we have the opportunity for confusion here, since you have both Python 2 and Python 3.  baseu-2.9.so should be a symlink to one of the two builds (Python 2 and Python 3).  Your _glcanvas.so was linking to "baseu-2.9.so", without a version, although it was in the Python 2.7 library directory.  Can you show an "ls -l" so we can see the symlinks?

최원준

unread,
Jan 24, 2012, 9:49:08 PM1/24/12
to wxpytho...@googlegroups.com
[===>11:45:39]~:ls -l
total 132
drwxr-xr-x  2  4096 2012-01-20 11:10 Desktop
drwxr-xr-x  2  4096 2012-01-19 11:23 Documents
drwxr-xr-x 24  4096 2012-01-19 16:48 Downloads
-rw-r--r--  1   179 2011-12-24 01:54 examples.desktop
-rw-rw-r--  1 79439 2012-01-25 09:09 hs_err_pid2379.log
drwxr-xr-x  7  4096 2012-01-18 15:23 Music
drwxr-xr-x  2  4096 2011-12-23 19:29 Pictures
drwxr-xr-x  2  4096 2011-12-24 01:56 Public
-rw-------  1   135 2012-01-20 09:45 pythonrc
-rw-------  1   112 2011-12-16 10:49 pythonrc~
drwxr-xr-x  2  4096 2011-12-24 01:56 Templates
drwxrwxr-x  2  4096 2012-01-18 14:58 Ubuntu One
drwxr-xr-x  2  4096 2011-12-24 01:56 Videos
drwx------  8  4096 2012-01-06 09:54 workspace


[===>11:44:56]~:locate baseu-2.9.so
/Downloads/wxPython/wxPython-src-2.9.2.4/bld/lib/libwx_baseu-2.9.so
/Downloads/wxPython/wxPython-src-2.9.2.4/bld/lib/libwx_baseu-2.9.so.2
/Downloads/wxPython/wxPython-src-2.9.2.4/bld/lib/libwx_baseu-2.9.so.2.0.0
/Downloads/wxPython/wxPython-src-2.9.2.4/wxPython/wxpy-bld/lib/libwx_baseu-2.9.so
/Downloads/wxPython/wxPython-src-2.9.2.4/wxPython/wxpy-bld/lib/libwx_baseu-2.9.so.2
/Downloads/wxPython/wxPython-src-2.9.2.4/wxPython/wxpy-bld/lib/libwx_baseu-2.9.so.2.0.0
/Downloads/wxPython/wxPython-src-2.9.3.1/bld/lib/libwx_baseu-2.9.so
/Downloads/wxPython/wxPython-src-2.9.3.1/bld/lib/libwx_baseu-2.9.so.3
/Downloads/wxPython/wxPython-src-2.9.3.1/bld/lib/libwx_baseu-2.9.so.3.0.0
/Downloads/wxPython/wxPython-src-2.9.3.1/wxPython/wxpy-bld/lib/libwx_baseu-2.9.so
/Downloads/wxPython/wxPython-src-2.9.3.1/wxPython/wxpy-bld/lib/libwx_baseu-2.9.so.3
/Downloads/wxPython/wxPython-src-2.9.3.1/wxPython/wxpy-bld/lib/libwx_baseu-2.9.so.3.0.0
/Downloads/wxPython/wxWidgets-2.9.3/lib/libwx_baseu-2.9.so
/Downloads/wxPython/wxWidgets-2.9.3/lib/libwx_baseu-2.9.so.3
/Downloads/wxPython/wxWidgets-2.9.3/lib/libwx_baseu-2.9.so.3.0.0
Reply all
Reply to author
Forward
0 new messages