Tag Info

Hot answers tagged

4

Version 10.1 now supports the Method->"Queued" option for EventHandler. Unfortunately, I forgot to document that fact (sorry!). Documentation updated now for future releases. Also, your code could be improved by making a progress indicator that doesn't do kernel evaluations. This progress indicator just runs in the FE and won't get any hiccups from ...


3

n = 3; Manipulate[Graphics[{Circle[{0, 0}],Line[{{0, 0}, a[[#]]} & /@Range[Length@a]]}], {{a, RandomReal[{0, 1}, {n, 2}]}, Locator, LocatorAutoCreate -> True}] Alternatively, Manipulate[Graphics[{Circle[{0, 0}], Line[Tuples[{{{0, 0}}, a}]]}], {{a, RandomReal[{0, 1}, {n, 2}]}, Locator, LocatorAutoCreate -> True}]


2

Edit I've updated my answer entirely since the updated question First Issue As detailed in the documentation for Initialization, this expression is not evaluated until after the content of the DynamicModule has been evaluated and not until "the construct is first displayed". This requires that any Initialization variable must be wrapped in Dynamic to be ...


1

The following might give you some idea how it could be done. I assume that your regions are given by a Boolean function of two arguments, and therefore can be displayed with RegionPlot. For example, when your region is a circle, the region function is region=#1^2+#2^2<=1& and the region can be displayed as follows: RegionPlot[region[x,y], ...


1

There are some other interesting aspects with this strange behaviour observed by Kuba. LinkSnooper shows a bit more. When the option UpdateInterval is used in a Dynamic expression, the clock of the kernel is used. Indeed, each second the kernel sends a message to the frontend, and the frontend starts an update procedure. So what happens when we close the ...


1

As Fred has suggested, Initialization is the way to go, and here is a minimal example: DynamicModule[{answer, answers = Range@10, order}, Column[{ "Pick 1:", Dynamic[RadioButtonBar[Dynamic@answer, answers[[order]]], TrackedSymbols :> {order}] }] , Initialization :> ( order = RandomSample@Range@Length@answers; ), ...


1

for completeness here is the LocatorPane version suggested by @m_goldberg comment. DynamicModule[{pt = RandomReal[{-1, 1}, {3, 2}]}, LocatorPane[Dynamic@pt, Graphics[{Circle[], Line[{{0, 0}, Dynamic@pt[[#]]}] & /@ Range@Length@pt}]]]



Only top voted, non community-wiki answers of a minimum length are eligible