

Executing GUIs

One of the most basic features of GUIKit is loading and executing an existing user interface application. This can be accomplished in one step in either a modal or modeless session with the Wolfram Language kernel using GUIRunModal or GUIRun.

Load the GUIKit` package before calling any GUIKit functions.

Click for copyable input

Here you load and execute an example user interface for a simple calculator that uses the Wolfram Language kernel for the calculations and, on closing, returns the results to the kernel.

Click for copyable input

Here is a screen shot of what the previous interface would look like on a typical platform.

The GUIKit functions will search a path defined by the symbol $GUIPath to discover user interfaces so that only a short path to the definition is necessary.

Here is another example that provides an input dialog for entering angles. With both examples, a modal session with the kernel is initiated so that control and the result is only returned to the kernel when the user is finished.

Click for copyable input

Here is a screen shot of what the previous user interface would look like on a typical platform.

You are also free to execute an interface in a modeless fashion. Executing the previous calculator example again with GUIRun immediately returns control to the kernel, but the calculator window continues to function. Also note that in a modeless session there is no way for the interface to return a custom result to the kernel when closed as the result value of the call to GUIRun.

Click for copyable input

The next two sections explain the GUIObject expression that is returned from GUIRun and discuss some features of working with modeless windows. Also discussed is a technique of delaying the execution of the user interface, even if used with a modal session, so that you can customize its features before presenting it on screen.