Vizard 7 » Reference » Graphical user interfaces (GUIs) » Dialog boxes » vizinput properties
7.6

vizinput properties

Changing the title, parent, and position of a dialog

All vizinput dialog objects accept the same optional keyword arguments for changing their title, parent object, and position. The following table lists these arguments and their default values:

Argument

Description

title = 'Vizard'

A string value that is displayed in the upper left corner of the dialog.

parent = viz.window.getHandle()

This can either be the Vizard graphics window or the desktop. By default it is set to the Vizard graphics window. When parenting to the desktop set this argument to 0

center = vizinput.CENTER

Sets the dialog's position in relation to the parent object. See the table below for a list of available flags.

pos = None

This will set the x and y position of the dialog in pixel coordinates, where (0,0) is the upper left corner of the monitor. If a value is given here, the center argument will be ignored.

The following flags and combinations of flags can be used with the center argument:

Flag

vizinput.CENTER

vizinput.CENTER_LEFT

vizinput.CENTER_RIGHT

vizinput.CENTER_TOP

vizinput.CENTER_BOTTOM

vizinput.CENTER_LEFT|vizinput.CENTER_TOP

vizinput.CENTER_RIGHT|vizinput.CENTER_TOP

vizinput.CENTER_LEFT|vizinput.CENTER_BOTTOM

vizinput.CENTER_RIGHT|vizinput.CENTER_BOTTOM

Example

import viz
viz.go()

import vizinput
vizinput.message('Parented to the Vizard Window, top center',center=vizinput.CENTER_TOP)
vizinput.message('Parented to the Desktop, top center',parent=0,center=vizinput.CENTER_TOP)
vizinput.message('Positioned using pixel coordinates',pos=[50,50])
vizinput.message('A different title', title='myApp')

Changing default properties

The vizinput module provides commands to change the title, parent, and center defaults. This is useful when you need to make a change to multiple dialogs. Instead of using a keyword argument each time one is created, the default command is called once and is applied to all dialogs that follow:

Command

Description

vizinput.setDefaultTitle(title)

title: A string that sets the default title.

vizinput.setDefaultParent(parent)

parent: Sets the default parent object. Use 0 to parent to the desktop and viz.window.getHandle() to parent to the Vizard graphics window

vizinput.setDefaultCenter(center)

center: Sets the default center.

Example

The following example sets new center and title defaults:

import viz
viz.go()

import vizinput

#Set new default center
vizinput.setDefaultCenter(vizinput.CENTER_BOTTOM)

vizinput.message('New default center')
vizinput.color(viz.RED)

#Set new default title
vizinput.setDefaultTitle('MyApp')

vizinput.message('New default title')
vizinput.choose('select...',['1','2','3'])

vizinput dialogs

vizinput properties