# Tag Info

192

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

112

Completely redesigned at 2015 12 19! Simplified interface, more functionality, robust performance. Plots can now be easily uploaded to StackExchange from within PlotExplorer thanks to halirutan! Code is at end of post. Functionality: Works with any graphics object, plots, charts, etc. (e.g. Plot, ListPlot, ArrayPlot, RegionPlot, GeoGraphics, BarChart, ...

50

I'd build something using Monitor and ProgressIndicator. For example: Monitor[ Table[Pause[0.1]; Prime[i], {i, 100}], Row[{ProgressIndicator[i, {1, 100}], i}, " "] ] This shows a progress indicator while the calculation is underway and then it disappears once the calculation has finished If you look at Jeremy's file progress.m you linked to, ...

38

My simple version using Image: size = 300; r = ListConvolve[DiskMatrix[#], RandomInteger[BernoulliDistribution[0.001], {5 size, size}], {1, 1}] & /@ {1.5, 2, 3}; Dynamic[Image[(r[[#]] = RotateRight[r[[#]], #]) & /@ {1, 2, 3}; Total[r[[All, ;; size]]]]] Update A slightly prettier version, same basic idea but now with flakes. flake := Module[...

38

You are correct about the behavior of computations done from preemptive links. So-called "preemptive evaluations" have been around since version 6. They are a class of evaluations that all work through the same mechanism. When Mathematica checks to see if a user interrupt has been requested, which it does at a high rate most of the time, it also looks to see ...

36

In addition to István's fine answer, there is also ExperimentalExplore[] which provides almost all the functionalities in his PlotExplorer. I think it was Szabolcs who first told me of this function. If you call the above function with no arguments, you can choose to interactively work with either Plot, ParametricPlot, Manipulate or Graphics. Alternately, ...

34

Date-picker implementation in Mathematica The following is my implementation of a simple date-picker. The current date is highlighted in LightBlue and the weekends are highlighted in LightGreen. The selected date is always highlighted in LightRed (the default selection is the current date). You can tap into this calendar by using the Dynamic values for ...

34

For this purpose, I wrote a small Symbol Information Palette. This palette let's you quickly look up usages, options and attributes of symbols and was tested on Mac OSX and Linux. Installation The source code is hosted on my GitHub site but to preview or install the palette you only have to evaluate this: Get["http://goo.gl/QPywk"] The link is just ...

28

Start from {Slider[Dynamic[x], {1, 5, 1}], Dynamic[x]} Next localize control variable: DynamicModule[{x}, {Slider[Dynamic[x], {1, 5, 1}], Dynamic[x]}] And add some interface elements: Panel@DynamicModule[{x}, Column[{Slider[Dynamic[x], {1, 5, 1}], Panel[Dynamic[x], ImageSize -> 200]}]] Add even more Panel@DynamicModule[{x}, Column[{...

27

One of the excellent places to look is the Wolfram Demonstration Project. There are many cases with custom controls there. You can test out controls immediately and download the source code. Because I know that site pretty well I will keep the list here. Relief-Shaded Elevation Map 3D Waves Potter's Wheel Motion Blur Contours of Algebraic ...

26

While trying to debug this issue myself, I stumbled across Todd Gayley's name in the source of one of the documentation .m files and contacted him directly. Todd was super great to work with---and at the end of an hour of screensharing he provided an easy workaround. The workaround essentially short-circuits one tiny feature of a normal documentation search....

23

All palette state (i.e., variables which affect the palette and should be remembered between sessions) should be vectored through the palette's TaggingRules option, and its initialization should be done in the palette's NotebookDynamicExpression option. That, plus context isolation of any kernel functions you need to define should solve all of the points ...

22

I happened to create some snowflakes and snow fall a couple weeks back, and its nice to have some place to share with others! First, we create some algorithmically generated snowflakes with some randomness using a kind of iterated function system based off the 6-pointed "star" shown below. H = Table[{Cos[n*Pi/3], Sin[n*Pi/3]}, {n, 0, 5, 1}]; Graphics@...

21

Short answer: yes, it is possible. The problem is that parsing is done line-by-line only for the top-level code. For code inside some head(s), it is first parsed as a whole. Therefore, your f is parsed to Globalf, and this is why that symbol is used. Here is what you can do, schematically: DynamicModule[{x = 5}, With[{def = MakeBoxes[f[y_] := y^2 + 1;], ...

21

Preliminaries As Todd has indicated in his answer which has a lot of excellent information, the situation where the described behaviour will actually trigger problems will be very rare. I also read from his answer that WRI doesn't consider this behavior to be a bug and my hopes that this might change in future versions are low or nonexistent. I show ...

20

I don't like to answer my own question, but to give an idea of what an answer might be here's my first stab at this (in the form of a toolbar), just try running UtilityDock[] and click "Branch" after saving it. (Note: I think the best answer wouldn't make use of a toolbar) UtilityDock := (c = Cell[BoxData[ ToBoxes[Grid[{{Item[ Row[{" ...

20

The problem is that inside the Manipulate, m1 and m2 are replaced with localized versions (as in Module) rather than assigned (as in Block). Since the m1 and m2 from bigA are outside the Manipulate, and bigA[t] is evaluated only after the replacement of m1 and m2 inside the Manipulate, they are not affected by the manipulation. The best solution is to give ...

20

Here's a simple way using buttons, for some reason AutoAction is not working so you have to click, anyone know why? nextPos[p_, r_] := {p + # r/2, r/2} & /@ Tuples[{1, -1}, 2] DynamicModule[{diskList = {{ {0, 0}, 1}}}, Graphics[Dynamic[ Button[{ColorData["Rainbow"][Last@#], Disk @@ #}, diskList = DeleteCases[Join[diskList, nextPos @@ #], #] ...

20

Presumably your Notebooks are not being saved in a Trusted Path. Start by reading the tutorial Notebook Security, and note: If the notebook's directory is trusted, the notebook will be allowed to automatically perform dynamic evaluations without alerting the user. If the notebook's directory is untrusted, the user will be alerted upon any attempt by the ...

19

AnimationRate is at least one way to do this, and it can be applied on a per-control basis: Manipulate[x, {x, 0, 10, AnimationRate -> 1/10, Appearance -> "Open"}] Manipulate[x, {x, 0, 10, AnimationRate -> 10, Appearance -> "Open"}]

19

There are several things to understand here, but all of them center around a common theme. Exactly what is evaluating, and exactly when? It looks like you're just trying to guess what's going on, but guessing is bad... you really should understand the evaluation model. A: Problems with the code in the question The method in the question would not have ...

19

If you pass SynchronousUpdating->False to Dynamic, it will perform operations on the main link. Note that this only works where Dynamic is displayed as a typeset result (i.e., typeset as a DynamicBox). It does not presently work where Dynamic is used to give a value to a control (such as Slider) or an option. A quick survey of other constructs... ...

19

I think I have to explain how I look at Dynamic before I can speak about Refresh. Dynamic is the basic element of dynamic updating, and the only one as far as I can tell. Anything that behaves dynamically has Dynamic somewhere inside it, I believe. If you think of an expression as a tree, then Dynamic[code] marks out the branch representing code for ...

18

This is basically the same as what b.gatessucks is doing. The main addition is that I've put all the locators in one list. To add vertices to the polygon you just click somewhere on the graph. I've also added a reset button and a button that prints the indices of the points inside the polygon which makes it easier to copy. points = RandomSample[ ...

18

This isn't exactly what you asked for, but it might do the trick. This solution allows you to create a number of different shapes (circle, polygon, line, Bezier curve, etc.). To add a shape, press the "New object" button. You can add points to an existing shape by clicking anywhere in the plane. Note that I'm using LocatorAutoCreate -> All instead of ...

18

By specifying different values for time and frequencyInverse, the behavior of flashing can be finetuned. time = 100; frequencyInverse = 4; i = 0; Dynamic@Style["TESTESTEST", Bold, RGBColor[color, 0, 0]] RunScheduledTask[(i = i + 1; color = Rescale[Sin[i/frequencyInverse], {-1, 1}]; If[i == time, RemoveScheduledTask[ScheduledTasks[]]; color = 0]), {....

18

Yes, I did something like that and it runs very very nicely. What I implemented is a dynamic Newton fractale visualizer where you can manipulate the number and position of the complex roots, the colours and the gamma correction settings from the Mathematica side. These values are sent to a parallel C++ implementation which calculates the fractale into a ...

18

A reliable composition of elements Perhaps something like this? (Edit: Fixed to work with Autorun.) Note that the InputField label is editable, similar to a normal Manipulator. One can also add an additional InputField[Dynamic @ x] if a regular InputField is desired. Manipulate[ x, {{x, 1.}, 1., 100., Row[{Slider[Dynamic[Log10[#], (x = 10^#) &], ...

18

In this case I don't know how to post something helpful without providing full code so I'll just do that and hope this wasn't homework. My emphasis is on clarity (hopefully) rather than brevity or peak efficiency. flip = # /. {LightRed -> LightBlue, LightBlue -> LightRed} &; flipNeighbors[i_, j_] := (color[##] = flip @ color[##];) & @@@ ...

17

What you want to do (make this piece of GUI resistant to kernel quits) can be achieved simply like this: DynamicModule[ {x = True, tag = Unique[StringJoin["g", ToString[ \$SessionID]]]}, CreateDocument[{"hello"}, TaggingRules -> tag, Visible -> True]; Checkbox[Dynamic[x, (x = #1; TrueQ[Select[Notebooks[], ...

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