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 viz, wx
viz.go(viz.EMBEDDED|viz.TRACKER)
class VizFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, -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(self, 5000)
self.timer.Start(10)
#self.Bind(wx.EVT_TIMER, self.OnTimer)
wx.EVT_TIMER(self, 5000, self.OnTimer)
def OnTimer(self, event):
#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.EULER, viz.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()