Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Create a PaneSelector that changes content on a schedule
ResourceFunction["TimedPaneSelector"][content,Dynamic[state],rules] displays a PaneSelector with content that periodically changes state as specified by rules. | |
UpdateInterval | 0.1 | how frequently the remaining time should be checked |
"ResetTime" | <||> | time before the state changes (can be state dependent) |
"DefaultResetTime" | 1. | reset time to use if the "ResetTime" option is unspecified for a given state |
Create a PaneSelector that switches between two states periodically:
In[1]:= | ![]() |
Out[2]= | ![]() |
The Dynamic variable tracks the current state of the PaneSelector:
In[3]:= | ![]() |
Out[3]= | ![]() |
This one will change to the second state and then stop changing:
In[4]:= | ![]() |
Out[4]= | ![]() |
Show how much time is left before a change:
In[5]:= | ![]() |
Out[5]= | ![]() |
Resetting the state externally will reset the timer (if the state is specified to change at all):
In[6]:= | ![]() |
Out[6]= | ![]() |
Update the remaining time more frequently:
In[7]:= | ![]() |
Out[7]= | ![]() |
Specify that state 1 should be active for one second and state 2 should be active for five seconds:
In[8]:= | ![]() |
Out[9]= | ![]() |
ResetTime accepts Dynamic values:
In[10]:= | ![]() |
Out[10]= | ![]() |
If the "ResetTime" option does not resolve to a numerical value, the "DefaultResetTime" will be used:
In[11]:= | ![]() |
Out[11]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License