WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 03-14-2009, 04:17 AM
levisii levisii is offline
Member
 
Join Date: Mar 2009
Posts: 8
oh, i'm sorry. first time i'm posting here
i've splitted my code to one files per class, but if you run this, it is showing my problem:

Code:
import viz, wx

#This class implements the GUI-Frame
class MainFrame(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title)

        #Menubar
        menubar 	= wx.MenuBar()
        worldViz 	= wx.Menu()
        worldViz.Append(104, '&Simulation', 'Start a 3D-simulation')
        menubar.Append(worldViz, '&WorldViz')
        self.SetMenuBar(menubar)
        self.CreateStatusBar()

        wx.EVT_MENU(self, 104, self.onStart3D)

    #calls the embedded simulation
    def onStart3D(self, event):
        self.timer = wx.Timer(self, 5000)   #Timer for updating the frames
        self.timer.Start(10)
        wx.EVT_TIMER(self, 5000, self.onTimer)

        viz.go(viz.EMBEDDED)
        simulation()

    #Manuel FrameUpdate
    def onTimer(self, event):
        viz.updateframe()
        
#this is my test simulation
def simulation():
    viz.clearcolor(0.5, 0.5, 1.0)

    #Set ViewPoint
    view = viz.MainView
    view.setPosition(0, 1, -20)

    #Turn on the physics engine
    viz.phys.enable()

    #Add ground
    ground = viz.add('tut_ground.wrl')
    ground.collidePlane()

#Exit-function
def onkeydown(key):
    if key == '1':
        print 'onKeyDown() executed'
        viz.quit()

viz.callback(viz.KEYDOWN_EVENT, onkeydown)

def onexit():
    print'onExit() executed'
    viz.quit()

viz.callback(viz.EXIT_EVENT, onexit)


#this is the starting class
class MainApp(wx.App):
	def OnInit(self):
		frame = MainFrame(None,-1, 'Phantom')
		frame.Show(True)
		return True

app = MainApp(0)
app.MainLoop()
del app
Reply With Quote
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
vizard quit automatically in full screen stereo mode fuyonggang Vizard 3 09-15-2008 09:51 AM
closing files on a force quit vadrian Vizard 1 02-14-2005 11:38 AM
embedded Vizard tavaksai Vizard 5 12-21-2004 07:49 AM


All times are GMT -7. The time now is 12:07 PM.


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