Tutorial 12: Exploring Interactivity

In this tutorial, we focus on different ways in which you can interact with Mathematica.  Different people will explore different techniques based on their project.

The most versatile and portable method to interact with Mathematica is to use Manipulate.  If you want to create a Demonstration for the Wolfram Demonstrations Project, you should base your ideas around a Manipulate command that doesn’t involve too many fancy types of input.  This might be a good time to go back into the Documentation Center and read some of the advanced techniques for Manipulate: ref/Manipulate

Dynamic

To be able to have more advanced interactivity and dynamic computation, you need to use the Dynamic command.  Work through this tutorial: tutorial/IntroductionToDynamic.  It will then be helpful to work through this tutorial: tutorial/AdvancedManipulateFunctionality

Text input

To request data from users inside a Manipulate command use  ControlType->InputField.  Or more generally, construct your own InputField.
See here: ref/InputField

You can request all sorts of information from a user.

Manipulate[Plot[f,{x,0,10}],{{f,x^3,"Insert a function of x:"},ControlType->InputField}]

Sometimes you need to modify the input so that Mathematica can use it, and you might need to convert between Strings and Expressions.  
See guide/ConvertingBetweenExpressionsAndStrings.

Manipulate[Permutations[Characters[text]],{{text,"word","Insert text here"}}]

Input by clicking

If you want to get simple Yes/No information or Multiple Choice information from a user, you could use a dialog box.  More information here: guide/DialogBoxes

ChoiceDialog["Pick one",{1->"a",2->"b",3->"c",4->"d"}]

To use clicking as a source of user interactivity, you might use the ControlType->Locator option in Manipulate.  It is also possible to build clicking on top of Graphics using ClickPane.
Documentation: ref/ClickPane

DynamicModule[{pt={0,0}},
ClickPane[
Dynamic@Graphics[
{Yellow,Disk[],
Black,Point[pt],
Text[Round[pt,.01],{0,0}]
},ImageSize->Tiny
],(pt=#)&]]

Using a game controller

Read this information: howto/UseBuiltinGamepadSupport

Importing data, spreadsheets, images

A more basic level for interacting with the user is to import information that you then go on to modify.  (Analyzing data, Modifying images...)  Use the Import command to to this.
See here: tutorial/ImportingAndExportingData.

Using curated data

You can access all of Wolfram’s curated data on many many subjects. See here for all the different types of data available: guide/ComputableDataOverview.