Tag Info

Hot answers tagged

110

Well, the answer seems to be YES :) Here is my implementation of Minecraft classic game in Mathematica. Let’s start with some screenshots which were taken during the construction of the final scene which will be displayed an the end of this post. Features Blocks are creatable and removable One texture per block Player automatically jumps to the ...


6

Yes, it is possible. Have you read the tutorials about Dynamic? Here is a simple example of a continuously updated time which changes color on Mouseover Dynamic[Refresh[ Mouseover[DateString[],Style[DateString[],20,Blue]], UpdateInterval->1]] Here the slightly more complex example with two buttons. DynamicModule[{bold=False,blue=False}, Column[{ ...


4

You want to create an independent DynamicModule for each EventHandler. Otherwise, the single variable col will control the color for all of the disks, as you're witnessing. Your code can be rearranged as follows: radius = 1; numDisks = 3; Graphics[Table[ DynamicModule[{col = Red}, EventHandler[{Dynamic[col], Disk[{2.5*(i - 1), 0}, ...


3

The objective of the question was to clarify whether EventHandler should work with DateListPlot (work arounds were not sought). Wolfram tech support confirmed that EventHandler does not work with DateListPlot. This is not a bug it is just that this capability is not available for DateListPlot.


3

I couldn't get the mouse to change appearance while being pressed, so I think you'll need a work-around. What I would suggest is to simulate the mouse with a graphics Inset that looks like an arrow and follows the mouse, while making the actual mouse cursor invisible for the entire time the mouse is inside the object. This works only if the object is ...


3

I was just working along the lines of @Rojo's comment: DynamicModule[{i = 0, state = False}, Dynamic[If[ControllerState["Button 1"], If[state, i = i + 1; state = False], If[! state, state = True]]; i] ] Sometimes it appears that the mouse action is intercepted by Mathematica. You may find that unnacceptable.


2

Simple solution is: you have to use Method->"Queued" as option to button vars = {0, 0, 0, 0}; {Button["DO STUFF", (data = { {+0.18, -0.13}, {+0.84, -0.06}, {+0.05, +0.88}, {+0.24, -0.63}, {+0.67, +0.93}, {+0.05, +0.88}, {+0.65, +0.92}, {+0.01, +0.99}, {+0.17, -0.04}, {+0.23, -0.55}}; model[{a_, k_, w_, p_}] = a Exp[-k x] Sin[w x + p]; ...


2

Check what The Futz just said. However, you can go the ugly workaround way. Not recommended, since I don't think you have any guarantees that your code will be evaluated exactly once only when you click the button, but up to you. Try this Print@"I dare you to move the slider after pressing the button"; \ Slider[] EventHandler[Framed["Benjamin Button"], ...


2

What you need is, instead of MouseDown, "MouseClicked". MouseDown is always true, for left and right mouse button (stupid me)... DynamicModule[{pt = {0, 0}}, EventHandler[ Graphics[{Disk[Dynamic[pt], .1]}, PlotRange -> 1], {"MouseClicked", 1} :> (pt = MousePosition["Graphics"]), PassEventsDown -> True]]



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