WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-28-2015, 08:56 AM
mape2k mape2k is offline
Member
 
Join Date: Mar 2013
Posts: 60
vizinfo, vizdlg related questions

Dear all,

it seems that Vizard has quite a few ways to display text. Simple text boxes, vizinfo panels, dialog panels, grid panel, etc....

I have been using my own vizdlg.Dialog class so far, but there are some limitations and issues and I would like to start from scratch to find the best possible and most flexible way to display information.

First of all: what is really the difference between using a vizinfo panel or a vizdlg panel? To me they seem to be both doing almost the same job with little differences. What do you suggest I use to display text and images in a flexible manner? I don't need to input information via the panels. Just information display.

Second: I have not found a way to neatly wrap text. I would like the panel to be the same width, regardless of the length of the text and the text to wrapped in that panel. I have found that vizdlg panels may have minimal sizes, but if the text gets bigger the panel resizes accordingly. We have sometimes a lot of information for our test subjects and right now we need to break up the text strings manually, very tedious as you can imagine.

Thank your for any help and input!
Johannes
Reply With Quote
  #2  
Old 06-02-2015, 04:00 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,448
The vizinfo.InfoPanel uses a vizdlg.GridPanel to display information.

Perhaps you could write a function to split the text into strings of a specific length. If you need additional flexibility with GUIs, you might look into Python add-ons such as wxPython or Tkinter. These can be used with Vizard.
Reply With Quote
  #3  
Old 06-04-2015, 05:34 AM
mape2k mape2k is offline
Member
 
Join Date: Mar 2013
Posts: 60
Thanks for the reply Jeff. Are there any plans by the Vizard team to improve the vizdlg class (e.g. include word wrapping)? I would like to keep the code as simple as possible so that others (that are not as experienced in Python) may still be able to make changes to the code themselves.
Reply With Quote
  #4  
Old 07-10-2015, 09:23 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Support for wrapping text in vizdlg panels will be added in a future update. In the meantime, you can use the following code to enable text wrapping with Vizard 5.1:
Code:
import viz
import vizdlg
import vizact
viz.go()

class WrappedText(viz.VizText):

	def __init__(self, message, wrapWidth=None, **kw):
		viz.VizText.__init__(self,viz.addText(message, **kw).id)
		self._wrapWidth = None
		self.setWrapWidth(wrapWidth)

	def setWrapWidth(self, width):
		"""Set width at which text is wrapped"""
		if width != self._wrapWidth:
			self._wrapWidth = width
			if width is None:
				self.setBoxTransform(viz.BOX_DISABLED)
			else:
				self.setBoxTransform(viz.BOX_ENABLED | viz.BOX_FIXED)
				self.setBoxOffset([0.0, 0.0, width, 0.0])
				self.setTextOverflow(viz.OVERFLOW_WRAP)

			parent = getattr(self, '_parentPanel', None)
			if parent is not None:
				panel = parent()
				if panel is not None:
					panel.dirtyLayout()

	def getWrapWidth(self):
		"""Get width at which text is wrapped"""
		return self._wrapWidth

message = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sodales tellus nunc, id molestie felis rutrum id. Vestibulum gravida fermentum tortor ac fringilla. Maecenas ac eleifend enim, vitae rutrum odio. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis consectetur maximus ipsum, at fermentum orci tincidunt vitae. Donec tempus lectus ut auctor hendrerit. Curabitur iaculis volutpat arcu sit amet commodo. Nulla facilisi. Phasellus ut quam non lorem facilisis laoreet vel sed felis. Mauris sed nisi a lorem euismod ornare."

panel = vizdlg.Panel()
panel.setScreenAlignment(viz.ALIGN_CENTER)
text = panel.addItem(WrappedText(message, wrapWidth=200))

grow_action = vizact.call(text.setWrapWidth, vizact.mix(begin=200, end=500, time=1.0, interpolate=vizact.easeOutStrong))
shrink_action = vizact.call(text.setWrapWidth, vizact.mix(begin=500, end=200, time=1.0, interpolate=vizact.easeOutStrong))

vizact.onkeydown(' ', text.runAction, vizact.choice([grow_action,shrink_action]))
Reply With Quote
  #5  
Old 07-27-2015, 03:46 AM
mape2k mape2k is offline
Member
 
Join Date: Mar 2013
Posts: 60
Thank you very much for the help, I really appreciate it!
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
check user input using vizinfo panel armo Vizard 0 01-22-2015 02:05 AM
changing font color in vizdlg purdue_vr Vizard 1 09-17-2009 05:43 PM
Modifying Vizinfo to Support Re-parenting Tip Gladsomebeast Vizard 0 12-16-2008 05:34 PM
General Questions about Vizard: World Viz dav Vizard 5 08-28-2006 03:44 PM
vizinfo vadrian Vizard 1 11-05-2004 02:40 PM


All times are GMT -7. The time now is 04:53 AM.


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