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 ...


4

You can include an iterator along with the function in the mapping: k = 0; (++k; f[#]) & /@ Range[100];


3

Specifying an explicit PlotRange and moving the Dynamic outside the list in Graphics3D seems to create a smoother experience: DynamicModule[{vv = {0, 0, 1}, vp = {1.3`, -2.4`, 2.`}}, Graphics3D[ Dynamic[{Cuboid[], Line[{{0, 0, 0}, vv}]}], ViewPoint -> Dynamic[vp], ViewVertical -> Dynamic[vv], Boxed -> False, SphericalRegion ...


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}]


3

It seems to work if I remove the extraneous calls to Dynamic. Manipulate[ {p[[#]] & /@ Range[5], Select[p[[#]] & /@ Range[5], (#[[1]] != #[[2]]) &]} // TableForm, {p, None}, {{np, "", "Test"}, Column[{Dynamic[sP /@ Range[5] // Row, TrackedSymbols :> {np}]}] &}, Initialization :> ( np = 5; sP[i_] := ...


3

Download code You can download a notebook with all the code in it by running the following code: Import["http://goo.gl/NaH6rM"]["http://i.stack.imgur.com/sMWJ2.png"] Code with comments The first thing to do is to separate your headings from your data: rawdata = {{"n", "t(n)", "t(n)/t(n-1)", "Ø(t(n)/t(n-1))"}, {20., 1.15, "", 1.30081}, {21., 1.54, ...


3

Is this what you mean? Manipulate[ Grid[{{txt}, {idx}}], Grid[{ {"T", InputField[Dynamic[txt, {txt = #; idx = StringLength[txt]} &], String, ContinuousAction -> True]}, {"index", Manipulator[Dynamic[idx, {idx = #} &], {0, Dynamic@StringLength[txt], 1}], Dynamic[idx]} }], {{txt, ""}, None}, {{idx, 0}, None} ]


2

I agree with Rojo's comments under his answer and I'd upvote them but the example from tutorials given in his answer is more confusing than educational for me (as expressed in comments). "For me", not "in my opinion" so maybe one can learn more from this part of tutorial. Nevertheless, I want to show you examples were using Refresh really matters. Refresh ...


2

I observe no problem here: make[] := Manipulate[x^2, {x, 1, 5}] PasteButton["A dynamic object", make[]] // CreatePalette Perhaps you forgot to localize your variables with DynamicModule which Manipulate makes use of automatically?


1

Edit Code formatting on MMA.SE is not something I excel at. I my haste, I may not have answered your question appropriately. However, as you're only triggering the evaluation of Dynamic[Refresh[...]] on the push of a button (rather than non-deterministically) I believe it is appropriate to push the code here. Note that Method->"Queued" should be used if ...


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}]]]


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

You may consider moving the variables used for the dynamic clock into a dedicated context Dynamic[{clock`d, clock`h, clock`m, clock`s} = List @@ DateDifference[Now, DateObject[{2015, 5, 18}], {"Day", "Hour", "Minute", "Second"}][[1]]; Grid[Transpose@{{"d", clock`d}, {"h", clock`h}, {"m", clock`m}, {"s", Round@clock`s}}, Alignment ...



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