![]() |
|
#1
|
|||
|
|||
|
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... |
|
#2
|
|||
|
|||
|
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()
|
|
#3
|
|||
|
|||
|
Thats great - thanks. I've downloaded wxPython and started looking at that at the moment. Thanks for the help.
|
![]() |
|
|
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 |