WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   vizdlg inside a vizinfo (https://forum.worldviz.com/showthread.php?t=5566)

sbilleter 12-02-2015 07:57 AM

vizdlg inside a vizinfo
 
Is it possible to integrate a AskDialog into an InfoPanel ?

It seems that it is possible to add a vizdlg.Panel as a simple part of the InfoPanel
(Custom GUI Layout of the Vizard documentation). And as the AdkDialog is inheritating from the Dialog and then the Panel, it should be possible, but for the moment, my InfoPanel is just empty

Can you help me ?

it would be much easier than recreating the Askdialog inside the InfoPanel.
Thanks.

Stéphane

Jeff 12-04-2015 10:53 AM

Yes, here's an example:

Code:

import viz
import vizinfo
import vizdlg
import viztask

viz.go()

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

info = vizinfo.InfoPanel('An InfoPanel with Dialog')
info.addSeparator()

options = [('Option 1'),('Option 2')]
dialog = vizdlg.AskDialog(options=options, title='Ask Dialog')
info.addItem(dialog)

def showdialog():
    while True:
        dialog.selection = 0
        yield dialog.show()

        if dialog.accepted:
            print 'accepted', options[dialog.selection]
        else:
            print 'cancelled'

        yield viztask.waitTime(1)

viztask.schedule(showdialog())



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

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