WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-14-2008, 03:27 PM
Atul Thakur Atul Thakur is offline
Member
 
Join Date: Oct 2007
Posts: 15
wxPython and Flock of Birds

Hi:
Encountered another problem where I am trying to embed my script in wx and use the flock of birds. My script just hangs without throwing any error. Kindly point me to any example of such type. I searched but could not find.
regards,
-Atul
PHP Code:
import vizwx

viz
.go(viz.EMBEDDED|viz.TRACKER)

class 
VizFrame(wx.Frame):
    
def __init__(selfparent):
        
wx.Frame.__init__(selfparent, -1"Virtual Training Studio - Training Module"size=(800,600),style=wx.DEFAULT_FRAME_STYLE wx.NO_FULL_REPAINT_ON_RESIZE)
        
        
window wx.Window(self,-1)
        
        
#IMPORTANT: YOU MUST SET THE WINDOW BEFORE RUNNING ANY OTHER VIZ COMMANDS
        
viz.setwindow(window.GetHandle())
        
        print 
"window setting"
        
        
#IMPORTANT: SETUP A TIMER TO BE CALLED CONTINUOSLY, IN THIS CASE, EVERY 10 MILLISECONDS
        
self.timer wx.Timer(self5000)
        
self.timer.Start(10)
        
#self.Bind(wx.EVT_TIMER, self.OnTimer)
        
wx.EVT_TIMER(self5000self.OnTimer)
        
    
    
def OnTimer(selfevent):
        
#IMPORTANT: YOU MUST MANUALLY UPDATE THE GRAPHICS FRAME
        
viz.updateframe()
    
    
def Quit(self):
        
self.timer.Stop()
        
self.Close()
if 
__name__ == '__main__':
    
app wx.PySimpleApp()
    
frame VizFrame(None)
    
frame.Show(True)
    
pos = [0,0,0]
    
    
room viz.add("room.wrl")
    
room.translate(0,0,3)
    
    
table viz.add("table.wrl")
    
table.translate(0,0,3)
    
    
def onkeydown(key):
        if 
key == 'a':
            
pos sensor_obj.get(viz.EULERviz.ABSOLUTE_WORLD)
            print 
pos
    viz
.callback(viz.KEYDOWN_EVENT,onkeydown)
    
    
PORT_FOB 1
    BAUD_FOB 
115200
    sensor 
viz.add('flockofbirds.dls')
    
sensor.reset()
    
sensor_obj viz.add(viz.GROUP)
    
sensor_obj.link(sensor)
    
viz.tracker()
    
app.MainLoop() 
Reply With Quote
 

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 01:18 AM.


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