Tag Info

Hot answers tagged

4

shape1 := Graphics[{#, Circle[{0, 0}, 1.5], Disk[]}, ImageSize -> 10] &; shape2 := Graphics[{Lighter@#, Disk[]}, ImageSize -> 10] &; ClearAll[lOF]; lOF[nOfOverlays_, colors_List, opts : OptionsPattern[]] := DynamicModule[{layer = 1, pts = ConstantArray[{{100, 100}, {700, 700}}, nOfOverlays], col = ...


4

Edit: This is a rewrite. The original answer was more or less an extended comment containing some seemingly relevant clues. I've tracked down two probable issues, each related to a system variable, and there may be others. At least in either case, the crashing can be triggered or prevented.* It turns out that Dynamic@RegionPlot[..] depends on the ...


3

When a Symbol is "tracked" it means that when its value changes the Dynamic expression is refreshed, therefore your input updates as fast as possible because every refresh changes the value of t which causes a refresh which... you get the picture. Compare: Clear[t]; t = 1; Dynamic[Refresh[t++, UpdateInterval -> 1, TrackedSymbols -> {}]]


3

The x and y of the ContourPlot are interfering with the x and y inside of Dynamic. If you use for example ContourPlot[Total[Log[Clip[b-a.{x2,y2},{10^-10,\[Infinity]}]]],{x2,-2,2},{y2,-2,2},PlotRange->{-10,0}] it'll not crash. I guess this shouldn't be necessary.


2

simple version With a single codeline, ColorData["Atoms", "Panel"], can be transformed in a click panel for ElementData[]. {ColorData["Atoms", "Panel"] // ReplaceAll[#, RuleDelayed[ "MouseClicked", $_] :> (RuleDelayed["MouseClicked", atomClicked = Part[RuleDelayed["MouseClicked", $], 2, 2, 2, 1, 1, 1]])] &, Dynamic[atomClicked, Initialization :> ...


1

The more general solution to this problem is to make use of the Option SynchronousUpdating->False: pts=Flatten[Table[Through[{Cos,Sin}[\[Alpha]]] r,{\[Alpha],0.,360 \[Degree]-10^-5,60 \[Degree]},{r,1,2}],1]; LocatorPane[Dynamic[pts], Dynamic[Show[ Graphics[{Arrow /@ Partition[pts, 2]}], {a, b} = Transpose[Map[Module[{p1, p2, d}, {p1, p2} = #; ...


1

From tutorial/InteractiveGraphicsPalette you can see that quite a few of the lowercase keys are used by DrawingTools which becomes active once the cursor focus is on the graphics. So, the easiest work-around is to use uppercase letters in your EventHandler as suggested by pjc42. When the first argument of EventHandler does not contain a graphics object, ...


1

another idea but not an answer... DynamicModule[{keyList = {}, pts = {}, input = Null}, EventHandler[ {LocatorPane[Dynamic[pts], Graphics[Circle[], ImageSize -> 500], LocatorAutoCreate -> True, Appearance -> {Graphics[{Red, Disk[]}, ImageSize -> 10], Graphics[{Blue, Disk[]}, ImageSize -> 10]} (*LocatorPane**)], ...


1

This is only a partial answer but may help. See here for related case, it is probable that KeyDown "a" is reserved like "c". This does not work: DynamicModule[{someList = {}}, EventHandler[Graphics[{Blue, Disk[]}, ImageSize -> 100], {{"KeyDown", "a"} :> (AppendTo[someList, 1]; Print[someList])}]] (** doesn't work **) But changing "a" to ...


1

Refresh only sets a limit on how long expression can go without being updated. To keep t form being updated more often add a pause. t = 1; Dynamic[Refresh[Pause[1]; t++, UpdateInterval -> 1, TrackedSymbols :> {t}]] or do what Mr.Wizard indicated, which is better. But this sort of thing is best done by higher level constructs such as Clock or ...



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