GUIKIT PACKAGE TUTORIAL

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 Mathematica kernel using GUIRunModal or GUIRun.

Load the package before calling any GUIKit functions.

In[96]:=
Click for copyable input

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

In[97]:=
Click for copyable input
Out[97]=

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.

In[3]:=
Click for copyable input
Out[3]=

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.

In[4]:=
Click for copyable input
Out[4]=

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.

New to Mathematica? Find your learning path »
Have a question? Ask support »