WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #1  
Old 01-14-2008, 02: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
  #2  
Old 01-16-2008, 10:32 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
I ran your code and it didn't hang. What line of code is the script hanging on?
Reply With Quote
  #3  
Old 01-16-2008, 11:36 AM
Atul Thakur Atul Thakur is offline
Member
 
Join Date: Oct 2007
Posts: 15
Quote:
Originally Posted by farshizzo View Post
I ran your code and it didn't hang. What line of code is the script hanging on?
The code run fine if I comment out the fob invocation lines (PORT_FOB = 1 onwards till viz.tracker()).
But the code I posted hangs otherwise for me. On the Vizard output console I get
************************************************** ****************************
* VIZARD 2.53g *
* *
************************************************** ****************************

Loading File: room.wrl
Scaling image 'eastwall.jpg' from (1200,512) to (1024,512)
Loading File: table.wrl

And a gray window (not responding) pops up with hourglass cursor.

Actually, I am using FOB in a larger code and I figured out that this part is giving problem.

regards,
-Atul
Reply With Quote
  #4  
Old 01-16-2008, 11:58 AM
Atul Thakur Atul Thakur is offline
Member
 
Join Date: Oct 2007
Posts: 15
To be precise the code hangs on flg line
sensor = viz.add('flockofbirds.dls')

The flock is working fine otherwise on vizard (i.e.with other codes without wx)

-Atul
Reply With Quote
Reply

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:44 PM.


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