Skip to main content

Refresh

Wolfram Kernel
Execution environment
warning

Implementation differs from Mathematica

Refresh[expr_, interval_]

produces a dynamic window with expr reevaluated each interval of time specified in seconds or in Quantity provided in interval

Refresh[expr_, trigger_EventObject | trigger_String]

produces a dynamic window with expr reevaluated by trigger event (see Events).

Referesh has HoldFirst attribute.

Example

Refresh[Now // TextString, 1]

or even for decorated symbols

Refresh[Now, 1]

JIT Features

Refresh expression uses the same runtime optimization features as Manipulate and Animate, which can benefit some cases and prevent full reevaluation.

For example:

Refresh[RandomImage[], 0.2]

or

Refresh[ListLinePlot[RandomReal[{-1,1}, 100]], 0.2]
caution

Be careful with Plot or any other functions placed as expr with a fast refresh rate (< 1 second). It might cause a significant load to the system in some cases if JIT optimizations were not successful. Test it on longer update times beforehand.

Consider to use Offload for rapidly changing data (see more in Dynamics and Animation or PlotlyExtendTraces).