Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5957747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:26:44+00:00 2026-05-22T18:26:44+00:00

I’m in the following situation. I have a module with a GLCanvas, a wx.Panel

  • 0

I’m in the following situation. I have a module with a GLCanvas, a wx.Panel that contains the canvas and some buttons and a frame that displays them. Now my imports are as follow:

from OpenGL.GLU import gluPerspective
from OpenGL.GLUT import glutSolidSphere

from OpenGL.GL import GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_LEQUAL, GL_DEPTH_TEST, GL_SMOOTH, GL_PROJECTION
from OpenGL.GL import GL_LIGHTING, GL_LIGHT0, GL_POSITION, GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR, GL_LIGHT_MODEL_TWO_SIDE
from OpenGL.GL import GL_MODELVIEW,GL_TRIANGLES,GL_POINTS,GL_UNSIGNED_SHORT,GL_UNSIGNED_INT,GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST
from OpenGL.GL import glClear, glLoadIdentity, glTranslatef, glTranslate, glRotatef, glRotate, glColor4f, glClearColor, glClearDepth, glDepthFunc, glEnable
from OpenGL.GL import glViewport, glShadeModel, glMatrixMode, glDrawElements, glHint, glLightfv , glLightModeli
from wx.glcanvas import GLCanvas
import wx

This works fine. However if I try to move the import wx.glcanvas and import wx before the imports from GLU and GLUT python crashes with a “Exception Type: EXC_BAD_ACCESS (SIGSEGV)”. Since this frame won’t be my starting frame I have to call import wx before in other modules and when I reach this it will just crash. Any suggestions ?

Edit

So to better explain the problem. I have module 1 with my GLCanvas, GLPanel and MainWindow:

from OpenGL.GLUT import *
from OpenGL.GLU import *
from OpenGL.GL import *
from wx.glcanvas import GLCanvas
import wx

class myGLCanvas(GLCanvas):
---------some initialisations and stuff-------
#Actual draw
def OnDraw(self):
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
    glMatrixMode(GL_MODELVIEW)
    glLoadIdentity()                    
    glTranslatef(0.0, -5.0, -250.0)
    glTranslate(0.0, 0.0, -self.distance)
    glRotate(self.alpha, 0.0, 0.0, 1.0)
    glRotate(self.beta, 0.0, 1.0, 0.0)
    for b in self.dataBuffers:  
        b.bindAll()
        glDrawElements(self.glDisplayType, b.size, GL_UNSIGNED_INT, 0)
        b.unbind() 
    self.SwapBuffers()
-------------------more code------------------
================End of class GLCanvas=======================

class GLPanel(wx.Panel):
def __init__(self, parent, canvas, *args, **kwargs):
    wx.Panel.__init__(self, parent, *args, **kwargs)
    self.canvas = canvas

    self.button1 = wx.Button(self, label="POINTS")
    self.button2 = wx.Button(self, label="TRIANGLES")

    self.Bind(wx.EVT_BUTTON, self.setPoints, self.button1)
    self.Bind(wx.EVT_BUTTON, self.setTriangles, self.button2)

    self.sizer = wx.BoxSizer(wx.VERTICAL)
    self.sizer.Add(self.button1, flag=wx.BOTTOM, border=5)
    self.sizer.Add(self.button2, flag=wx.BOTTOM, border=5)


    self.border = wx.BoxSizer()
    self.border.Add(self.sizer, flag=wx.ALL | wx.EXPAND, border=5)

    self.SetSizerAndFit(self.border)

def setPoints(self, evt):
    self.canvas.setDisplayType(GL_POINTS)
    #-----------------------------------------------------------------------------------------------
def setTriangles(self, evt):
    self.canvas.setDisplayType(GL_TRIANGLES)
 ======================End of GLPanel========================= 
class MainWin(wx.Frame):
def __init__(self, *args, **kwargs):
    wx.Frame.__init__(self, title='OpenGL', *args, **kwargs)

    self.canvas = myGLCanvas(self, size=(640, 480))
    self.panel = GLPanel(self, canvas=self.canvas)

    self.sizer = wx.BoxSizer()
    self.sizer.Add(self.canvas, 1, wx.EXPAND)
    self.sizer.Add(self.panel, 0, wx.EXPAND)
    self.SetSizerAndFit(self.sizer)

    self.Show()

Ok so now if I go ahead and:

 app = wx.PySimpleApp(0)
 wx.InitAllImageHandlers() 
 main_win = MainWin(None)
 main_win.Show()
 app.MainLoop()

If I do this from the same module or from a module that does not use any import wx before, it works. But my application has a login screen, configuration screen etc that all use wx. So now at the point from my code that I want to create a MainWin(), I get the crash I mentioned before.

Basically what I’m saying is I have to create a GLPanel and myGLCanvas from:

import wx

class someOtherScreen(wx.Frame)
--------------code code-------------
canvas = myGLCanvas

So now the wx comes before the OpenGL imports and python just crashes.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:26:44+00:00Added an answer on May 22, 2026 at 6:26 pm

    I am doing this:

    from OpenGL.GLUT import *
    from OpenGL.GLU import *
    from OpenGL.GL import *
    from wx.glcanvas import GLCanvas
    import wx
    

    This should work fine for any application.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.