PDA

View Full Version : script crash


poolshark
10-09-2003, 12:10 PM
Hey,

My code was working perfectly for the previous version of Vizard. I downloaded it last week and the script started crashing so I downloaded it again today and still crashes. I think it crashes on this line:
viz.setwindow(p2.GetHandle())
Never did it before, its just crashing now. Any suggestions?

farshizzo
10-09-2003, 12:40 PM
I'm not aware of any changes to setwindow. I tested it out here and it's working fine. Are you sure it's the setwindow function. Are there any error messages? You might want to try commenting everything out except for the setwindow call to make sure this is causing the crash.

poolshark
10-09-2003, 12:47 PM
There are no error messages the windows things pops up with "send error report". I checked through using print statements and that's the line of code where it crashes. I don't think its even the p2.GetHandle part because I did that separately and the program doesn't crash.

farshizzo
10-09-2003, 01:05 PM
Can you try out the following code. It should just open up a wxWindow and display a spinning red square. If it is still crashing then your guess is as good as mine :p

from wxPython.wx import *
import viz

#IMPORTANT: YOU MUST DO THIS BEFORE RUNNING ANY OTHER CODE
viz.go(viz.EMBEDDED)

#---------------------------------------------------------------------------

class VizFrame(wxFrame):
def __init__(self, parent):
wxFrame.__init__(self, parent, -1, "Vizard Embedded Example", size=(800,600),style=wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)

window = wxWindow(self,-1)

#IMPORTANT: YOU MUST SET THE WINDOW BEFORE RUNNING ANY OTHER VIZ COMMANDS
viz.setwindow(window.GetHandle())

quad = viz.add(viz.TEXQUAD)
quad.translate(0,1.6,5)
quad.color(1,0,0)
quad.spin(0,1,0,90)
quad.disable(viz.LIGHTING)


#IMPORTANT: SETUP A TIMER TO BE CALLED CONTINUOSLY, IN THIS CASE, EVERY 10 MILLISECONDS
ID_Timer = wxNewId()
self.timer = wxTimer(self,ID_Timer)
self.timer.Start(10)
EVT_TIMER(self, ID_Timer, self.OnTimer)

def OnTimer(self, event):
#IMPORTANT: YOU MUST MANUALLY UPDATE THE GRAPHICS FRAME
viz.updateframe()


#----------------------------------------------------------------------

if __name__ == '__main__':
app = wxPySimpleApp()
frame = VizFrame(None)
frame.Show(True)
app.MainLoop()