WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-04-2010, 08:23 AM
malmct malmct is offline
Member
 
Join Date: Aug 2010
Posts: 3
Text Box

I'm trying to use a textbox for text entry. However, whenever I call .get() on the text box, it only returns an empty string, regardless of whats in the box.

Code:
class makeMenu:
	def __init__(self):
		
		#Menu Generation
		self.treadMenu=vizmenu.add()
		self.command=self.treadMenu.add("Commands")
		self.speed=self.treadMenu.add("Speed")
		
		#Command Box

		self.go=self.command.add(viz.BUTTON_LABEL,"GO")
		self.stop=self.command.add(viz.BUTTON_LABEL,"STOP")

		
		#Speed Box
		self.lspeed=self.speed.add(viz.TEXTBOX, "LEFT BELT SPEED:")
		self.rspeed=self.speed.add(viz.TEXTBOX, "RIGHT BELT SPEED:")

                          vizact.onbuttondown(trMenu.go, moveBuffer, trMenu.lspeed.get(), trMenu.rspeed.get())

def moveBuffer(lsp, rsp):
	print lsp
lsp is always an empty string.
Reply With Quote
  #2  
Old 08-06-2010, 10:02 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
The code below works. I'll find out why the values are not passed to the callback function the way you have it and get back to you.
Code:
import viz
import vizmenu

viz.go()

class makeMenu:
	def __init__(self):
		
		#Menu Generation
		self.treadMenu=vizmenu.add()
		self.command=self.treadMenu.add("Commands")
		self.speed=self.treadMenu.add("Speed")
		
		#Command Box

		self.go=self.command.add(viz.BUTTON_LABEL,"GO")
		self.stop=self.command.add(viz.BUTTON_LABEL,"STOP")

		
		#Speed Box
		self.lspeed=self.speed.add(viz.TEXTBOX, "LEFT BELT SPEED:")
		self.rspeed=self.speed.add(viz.TEXTBOX, "RIGHT BELT SPEED:")
		

trMenu = makeMenu()

def moveBuffer():
	print 'Left Belt Speed:  ',trMenu.lspeed.get()
	print 'Right Belt Speed: ',trMenu.rspeed.get()

vizact.onbuttondown(trMenu.go, moveBuffer)
Reply With Quote
  #3  
Old 08-06-2010, 01:58 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
The code you posted works as it should. When your callback function is registered through the vizact.onbuttondown command, the values in both text boxes are empty strings. Getting the textbox values at the time of the button press should be done in the callback function itself, as in my example.
Reply With Quote
  #4  
Old 08-10-2010, 08:18 AM
malmct malmct is offline
Member
 
Join Date: Aug 2010
Posts: 3
That makes sense. Thank you very much.
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
Vizinfo box: help with aligning text Woosuk Jang Vizard 4 07-15-2010 04:01 PM
Informationboxes with text snoopy78 Vizard 3 07-16-2009 10:23 AM
Vizard tech tip: Text to Speech Jeff Vizard 1 01-15-2009 09:39 PM
adding 2D text via script V.shazzle Vizard 3 09-19-2005 02:45 PM
3d Text with Transparent Borders vjosh Vizard 3 12-01-2004 10:50 AM


All times are GMT -7. The time now is 10:35 AM.


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