PDA

View Full Version : Slider with 2 labels


iva
08-18-2016, 09:16 AM
Hey guys,

I am trying to make a slider that has 2 labels, like this:

Very uncertain -------------------[]---- Very certain

I am using vizinfo, but I don't think this is an option. Anyone has a suggestion how to do it in an elegant way? Thank you!

Jeff
08-19-2016, 08:23 AM
Are you using the vizinfo panel for other GUI elements or just the slider and text? Panels from the vizdlg (http://docs.worldviz.com/vizard/#Vizdlg_introduction.htm) library support custom GUI layouts.

iva
08-25-2016, 08:20 AM
I am using it for other elements, too. It would be kind of a weird switch to use vizdlg just for the slider i think...

Jeff
08-28-2016, 01:21 AM
You can customize a vizinfo panel by adding vizdlg panels to it:

import viz
import vizinfo
import vizdlg

viz.go()

dojo = viz.addChild('dojo.osgb')

info = vizinfo.InfoPanel('InfoPanel with custom layout')

info.addSeparator()
textbox1 = info.addLabelItem('text box 1',viz.addTextbox())
textbox2 = info.addLabelItem('text box 2',viz.addTextbox())

info.addSection('vizdlg sub-panel with 3 elements in a row')
row = vizdlg.Panel(layout=vizdlg.LAYOUT_HORZ_BOTTOM,back ground=False,border=False)
text1 = row.addItem(viz.addText('Very uncertain'))
slider = row.addItem(viz.addSlider())
text2 = row.addItem(viz.addText('Very certain'))
info.addItem(row)