![]() |
#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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. |
#3
|
|||
|
|||
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.
|
#4
|
|||
|
|||
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])) |
#5
|
|||
|
|||
Thank you very much for the help, I really appreciate it!
|
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
![]() |
||||
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 |