WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   vizinfo, vizdlg related questions (

mape2k 05-28-2015 09:56 AM

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!

Jeff 06-02-2015 05:00 PM

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.

mape2k 06-04-2015 06:34 AM

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.

farshizzo 07-10-2015 10:23 AM

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:

import viz
import vizdlg
import vizact

class WrappedText(viz.VizText):

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

        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_ENABLED | viz.BOX_FIXED)
                                self.setBoxOffset([0.0, 0.0, width, 0.0])

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

        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()
text = panel.addItem(WrappedText(message, wrapWidth=200))

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

vizact.onkeydown(' ', text.runAction, vizact.choice([grow_action,shrink_action]))

mape2k 07-27-2015 04:46 AM

Thank you very much for the help, I really appreciate it!

All times are GMT -7. The time now is 04:15 PM.

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