PDA

View Full Version : How to change position of Radio Button in vizinfo.infoPanel?


Vishav
11-17-2017, 10:47 AM
Dear all

I want second radio button shown in the attached image near to ball picture as in case of apple. Use of set position command of the radio button is not making any effect. How to do it?

Source Code:
infoBox = vizinfo.InfoPanel('What object i am interested in?',fontSize=20,window=viz.MainWindow,icon=False, align=viz.ALIGN_CENTER)
infoBox.addSeparator(padding=(10,10))
infoBox.setTitle( 'Question 1' )
Apple = infoBox.addLabelItem('', viz.addRadioButton('color'))
infoBox.addSeparator(padding=(200,200))
#Ball.setPosition(680,0,500)
mapPos = [700,450,500]
mapScale = [200,200,200]
apple_i = viz.addTexQuad(parent=viz.ORTHO,scale=mapScale,pos =mapPos)
apple_i.texture(viz.addTexture('D:\PhD\Study-I_Part_I\Textures\Apple.jpg'))
apple_i.drawOrder(10)
ball_i= viz.addTexQuad(parent=viz.ORTHO,scale=mapScale,pos =[700,215,500])
ball_i.texture(viz.addTexture('D:\PhD\Study-I_Part_I\Textures\Ball.jpg'))
ball_i.drawOrder(10)
Ball= infoBox.addLabelItem('', viz.addRadioButton('color',pos=(680,500,500)))

submitButton = infoBox.addItem(viz.addButtonLabel('Submit'),align =viz.ALIGN_CENTER)
yield viztask.waitButtonUp(submitButton)

Regards

Vishav

Jeff
11-21-2017, 01:36 AM
It's possible to create custom layouts by adding vizdlg panels to the vizinfo panel. Texture quads can be added directly to panels. Here's an example:

import viz
import vizinfo
import vizdlg

viz.go()

dojo = viz.addChild('dojo.osgb')
info = vizinfo.InfoPanel('Custom info panel')

row1 = vizdlg.Panel(layout=vizdlg.LAYOUT_HORZ_TOP,backgro und=False,border=False)
radio1 = row1.addItem(viz.addRadioButton('images'))
texture1 = viz.addTexture('images/tile_grass.jpg')
quad1 = viz.addTexQuad(texture=texture1, scale=[100,100,1], align=viz.ALIGN_CENTER)
row1.addItem(quad1)
info.addItem(row1)

row2 = vizdlg.Panel(layout=vizdlg.LAYOUT_HORZ_TOP,backgro und=False,border=False)
radio2 = row2.addItem(viz.addRadioButton('images'))
texture2 = viz.addTexture('images/tile_stone.jpg')
quad2 = viz.addTexQuad(texture=texture2, scale=[100,100,1], align=viz.ALIGN_CENTER)
row2.addItem(quad2)
info.addItem(row2)

Vishav
11-21-2017, 04:04 AM
Thanks, Jeff It is working fine. You are great!

Roy
09-27-2020, 11:15 AM
Hi all,

How to change the arrangement of radio buttons from 'top to bottom' to 'left to right'?
In the InfoPanel, the buttons are added to below the previous one.