WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-12-2008, 07:56 AM
DavidHeesom DavidHeesom is offline
Member
 
Join Date: Jul 2006
Posts: 2
TK with Vizard

Hi

Just downloaded and started to play with TK and Vizard as we want to create an application that uses a windows style interface and menus but is it possible to embed the vizard graphics window into a TK application or is there an example on the forum I have missed somewhere.

Thanks for any help...
Reply With Quote
  #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
  #3  
Old 02-19-2008, 08:24 AM
DavidHeesom DavidHeesom is offline
Member
 
Join Date: Jul 2006
Posts: 2
Thats great - thanks. I've downloaded wxPython and started looking at that at the moment. Thanks for the help.
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

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 11:04 AM.


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