WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 02-13-2008, 02:19 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Here is a simple script that embeds the Vizard graphics window in a Tk application:
Code:
import viz
from Tkinter import *
import win32gui

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()
We have also embedded Vizard in wxPython applications, and it works a lot better than Tk. If you are not too attached to using Tk, then I would recommend using wxPython.
Reply With Quote
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
McAfee Privacy Service 8.1 causes Vizard not to run mspusch Vizard 2 09-24-2008 05:17 PM
Vizard won't run wouters Vizard 5 02-05-2008 11:12 AM
Fall 2007 release of Vizard R3 3 D Announcements 0 10-15-2007 04:50 PM
McAfee Privacy Service 8.1 causes Vizard not to run mspusch Vizard 0 03-01-2007 08:24 PM
Matlab and Vizard brystewa Vizard 1 09-18-2006 03:11 PM


All times are GMT -7. The time now is 05:14 PM.


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