WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Tkinter interface (https://forum.worldviz.com/showthread.php?t=2865)

malmct 08-02-2010 09:52 AM

Tkinter interface
 
I'm building a program based around a tkinter interface, which is supposed to start vizard rolling. However, when I try and do this, vizard gets caught at the loading screen and the splash animation plays endlessly. How do I fix this?

Jeff 08-02-2010 02:10 PM

The following example shows how to embed the Vizard graphics window into a TKinter application:
Code:

import viz
from Tkinter import *

class VizardApp(Frame):
        def __init__(self, master=None):
                Frame.__init__(self, master,width=800, height=600)
                self.pack()
               
                #Embed vizard using the viz.EMBEDDED flag and passing handle to existing window
                viz.go(viz.EMBEDDED,window=self.winfo_id())
               
                #Initialize Vizard environment
                viz.add('tut_ground.wrl')
                ball = viz.add('ball.wrl',pos=(0,1.8,2))
                ball.add(vizact.spin(0,1,0,90))
               
                #Need to setup timer to manually update vizard engine
                self.after(10,self.updateVizard)

        def updateVizard(self):
                """Update the vizard engine"""
                viz.updateframe()
                self.after(10,self.updateVizard)

# create the application
myapp = VizardApp()

# set title of application
myapp.master.title("Vizard Tkinter example")

# start the program
myapp.mainloop()



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

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