WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-21-2012, 07:33 AM
Sven Sven is offline
Member
 
Join Date: Apr 2010
Posts: 12
Creating a GUI outside of the Vizard-Window using Tkinter

Hi all,

I'm planning an experiment where the test subject is inside a chamber wearing VR-Glasses, on which the Vizard-Window is shown.
For the experimenter outside, I want to create a GUI using Tkinter that allows to control the various events happening during the experiment.
However, when I try to run my script, either the vizard-window is not opening until I close the Tkinter-GUI (if I create the GUI first), or the vizard-window opens but stops showing the splash-screen until I close the GUI (if I create the vizard-window first). A simplified code example is attached.
Does anybody have an idea how to solve this?

Code:
import viz
from Tkinter import *

viz.go()

track=viz.add('track.wrl')

class VizardApp:
    
    def __init__(self, master=None):

        self.varsp1=IntVar()
        self.varsp2=IntVar()

        Label(master, text="Audio Controls").grid(row=0)
        Label(master, text="   ").grid(row=1)
        Checkbutton(master, text="Playback 1 ON", variable=self.varsp1, command=self.prvar2).grid(row=2)
        Checkbutton(master, text="Playback 2 ON", variable=self.varsp2, command=self.prvar2).grid(row=3)
        Button(master, text="Quit", command=master.quit).grid(row=8, column=2)

	    
    def prvar1(self):
		print "var1 is", self.varsp1.get(), "var2 is", self.varsp2.get()

    def prvar2(self):

		print "var2 is", self.varsp2.get(), "var1 is", self.varsp1.get() 




root=Tk()

app=VizardApp(root)

root.mainloop()
Reply With Quote
  #2  
Old 03-22-2012, 12:36 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You'll need to embed the Vizard graphics window into the TK application. See this thread for an example.
Reply With Quote
  #3  
Old 03-22-2012, 01:24 AM
Sven Sven is offline
Member
 
Join Date: Apr 2010
Posts: 12
Yes, I've seen this thread, and also tried the code in there - but if I understood it correctly, this code combines my tkinter-GUI and the vizard graphics into one window. I need two independent windows, one for the test subject's VR-Glasses, one for the experimenter's computer monitor.
Is this even possible?
Reply With Quote
  #4  
Old 03-22-2012, 07:45 AM
JimC JimC is offline
Member
 
Join Date: Jun 2009
Posts: 42
I'd try either:

1) spawn a subsidiary thread using either the thread or threading module to create and handle the tkinter window (no idea if it would work), or;

2) Make the tkinter window a separate program that communicates with the vizard script through a socket.
Reply With Quote
  #5  
Old 03-22-2012, 08:35 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
I agree with JimC.

Alternatively, if you plan on upgrading to Vizard 4.0, you can use the new vizhtml module to create simple web pages that communicate with your script through any standard web browser.
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
Creating a Vizard Sensor Plugin farshizzo Plug-in development 25 08-01-2019 12:24 AM
How to make a glass window in Vizard Frank Verberne Vizard 9 07-27-2011 03:47 PM
Vizard 4 Beta Testing farshizzo Announcements 0 02-01-2011 10:46 AM
tkinter window focus John P Vizard 4 08-31-2009 05:51 AM
Vizard tech tip: Using the Python Imaging Library (PIL) Jeff Vizard 0 03-23-2009 11:13 AM


All times are GMT -7. The time now is 02:09 AM.


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