VrOne/Python Programming

ON-LINE REFERENCE DOCUMENTATION

CARDINAL SYSTEMS, LLC

386-439-2525    

www.cardinalsystems.net    mike@cardinalsystems.net
 

 

PyVrGui Class Reference

VrOne/Python graphical user interface and miscellaneous system routines. More...

Members


Detailed Description

The Python VrOne GUI Class contains graphical user interface routines.


Member Function Documentation

DspMsg (LabelStrg)

Places text into the message area of the main window. This is the bottom longest line.

LabelStrg

Text to place in message area.

DspMsg0 (LabelStrg)

Places text into message area 0 of the main window. This is the top longest line. This area is normally filled by fields but may be written as a single line with this routine.

LabelStrg

Text to place in message area.

DspState (FieldNum, Strg)

Places text a field of the state message area.

FieldNum

Field number (0-5)

Strg

Text to place in field (up to 39 char)

DspShortMsg (Num, LabelStrg)

Places text into the main window label area.

Num

Label area (0-1)

LabelStrg

Text to place in label area.

SetTitle (TitleStrg)

Sets the title sent in the main window's window title bar.

TitleStrg

Title to set.

ShowCoord (x, y, z)

Shows coordinate in main window.

x

X Coordinate to show.

y

Y Coordinate to show.

z

Z Coordinate to show.

ShowZ (z)

Shows elevation in main window.

z

Elevation to show.

ClearCoord ()

Clears the coordinate display area

OpenFileNameDialog (Title, DefaultDir, Ext)

Displays an open file dialog and returns the name of the file selected by the user.

Title

Title for dialog box.

DefaultDir

Initial path to display or leave blank to display the current working path

Ext

Allows you to limit the types of files displayed (Example: “*.txt” would only show files that have a .txt extension)

FileName

Return file name.

returns

(filename)

 

filename

File name selected by user

 

Example

(FileName) = OpenFileDialog (“Text File Input”, “”, “*.txt”)

if (FileName):

     InFile = open (FileName, "r") # Read data from file

     InFile.close()

SaveFileNameDialog (Title, DefaultDir, Ext)

Displays a save file dialog and returns the name of the file selected or entered by the user.

Title

Title for dialog box.

DefaultDir

Initial path to display or leave blank to display the current working path

Ext

Allows you to limit the types of files displayed (Example: “*.txt” would only show files that have a .txt extension)

returns

(filename)

 

filename

File name selected or entered by user

 

Example

(FileName) = SaveFileNameDialog (“Enter file name”, “”, “*.txt”)

if (FileName):

     OutFile = open (FileName, "w") # Write data to file   OutFile.close()

GetDirectoryName (Title, DefaultDir, ParamName)

Displays a directory selection dialog and returns the name of the directory selected.

Title

Title for dialog box.

DefaultDir

Initial path to display or leave blank to display the current working path

ParamName

Optional parameter filename so last location can be remembered

returns

(ret, filename)

 

ret

0=Ok pressed, 1=Cancel pressed

 

filename

Name of directory

MsgBox (MessageStrg, Title)

Displays a message in a modal dialog box with an OK button

MessageStrg

Message to display

Title

Title for window border

AlertBox (MessageStrg, Title)

Displays a message in a modal dialog box with an OK and Cancel button

MessageStrg

Message to display

Title

 

returns

(ret)

 

ret

O = OK pressed, -1 = Cancel pressed

ConfirmBox (MessageStrg, Title)

Displays a message in a modal dialog box with an OK and Cancel button

MessageStrg

Message to display

Title

Title for window border

returns

(ret)

 

ret

0 - Ok pressed, -1 - Cancel pressed

YesNoBox (MessageStrg, Title)

Displays a message in a modal dialog box with an Yes and No buttons

MessageStrg

Message to display

Title

Title for window border

returns

(ret)

 

ret

1 - Yes pressed, 0 - No pressed

YesNoCancelBox (MessageStrg, Title)

Displays a message in a modal dialog box with Yes, No, and Cancel buttons

MessageStrg

Message to display

Title

Title for window border

returns

(ret)

 

ret

1 - Yes pressed, 0 - No pressed, -1 - Cancel pressed

TryAgainBox (MessageStrg, Title)

Displays a message in a modal dialog box with an Try Again button

MessageStrg

Message to display

Title

Title for window border

CustomBox (MessageStrg, But0, But1, But2, Title)

Displays a message in a modal dialog box with up to 3 buttons

MessageStrg

Message to display

But0

Button title 0 (NULL = disabled).

But1

Button title 1 (NULL = disabled).

But2

Button title 2 (NULL = disabled).

Title

Title for window border

returns

(ret)

 

ret

Button number pressed (0-2 | -1=Escape or Close box pressed)

InputDialog (Prompt, Title)

Displays a dialog that allows the user to enter a text string.

Prompt

Prompt to display

Title

Title for window border

returns

(ret)

 

ret

String entered by user or blank if user didn't enter a string

 

Example

(InputStrg) = InputDialog (“Input Test”, “Please enter a string”)

PushKeyin (Strg)

Pushes a string into the VrOne Main Window key-in field and presses return. =Emulates a user typing a command or argument and pressing return. All VrOne key-ins are available to this function

Strg

String to push

 

Example

PushKeyin (“SnaOn, SnaInt, InsLin”)

GetCoord (Title)

Allows the user to select a location on the VrOne graphics window and returns the coordinate selected.

Title

Title to display in VrOne message area

returns

(status, x, y, z)

 

status

0=User selected point, 1=User cancelled selection

 

x, y, z

Coordinate selected by user (double precision)

 

Example

(stat, x, y, z) = GetCoord (“Select Coordinate”)

if (stat == 0):

     print ("Selected coordinate %.2f,%.2f,%.2f" % (x,y,z))

Beep (SoundFile, UseDefault)

Makes computer beep if beeping is turned on.

SoundFile

Sound file to play. Normally a .wav file

UseDefault

If a null string is sent for the sound file, play the default sound (default=TRUE)

ProgInit (Desc, TotalSteps)

Inits the progress bar.

Desc

Text description of task

TotalSteps

Total steps. May be any integer number

ProgSet (Progress)

Updates the progress bar

Progress

Progress count

returns

(ret)

 

ret

Current progress percent, or -1 if progress was not updated

ProgReset ()

Resets progress bar