WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   wxPython and Flock of Birds (https://forum.worldviz.com/showthread.php?t=1308)

Atul Thakur 01-14-2008 02:27 PM

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() 


farshizzo 01-16-2008 10:32 AM

I ran your code and it didn't hang. What line of code is the script hanging on?

Atul Thakur 01-16-2008 11:36 AM

Quote:

Originally Posted by farshizzo (Post 4897)
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

Atul Thakur 01-16-2008 11:58 AM

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


All times are GMT -7. The time now is 03:01 PM.

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