WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 10-09-2003, 01:05 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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

Code:
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()
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:24 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC