Re: Custom dialog during evaluation
- To: mathgroup at smc.vnet.net
- Subject: [mg111762] Re: Custom dialog during evaluation
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Thu, 12 Aug 2010 05:31:49 -0400 (EDT)
- References: <i3to2h$scm$1@smc.vnet.net>
Am 11.08.2010 10:47, schrieb Nate Dudenhoeffer: > I answered my own question. The key was using NotebookClose, not > DialogReturn[]. > > And, since I have far too much time on my hands, here is some code to create > a dynamic flower that should look familiar to Mac users. Along with an > example of how to use it: > > myflower := Module[{w, bigD, d}, > w = .22; > bigD = 2; > d = 1; > Dynamic[ > Graphics[{ > Rotate[ > Table[ > {GrayLevel[Min[{1 - (i/(2*\[Pi])), .8}]], > Disk[{bigD*Sin[i], bigD*Cos[i]}, w], > Polygon[{ > {d*Sin[i] - w*Cos[i], d*Cos[i] + w*Sin[i]}, > {bigD*Sin[i] - w*Cos[i], bigD*Cos[i] + w*Sin[i]}, > {bigD*Sin[i] + w*Cos[i], bigD*Cos[i] - w*Sin[i]}, > {d*Sin[i] + w*Cos[i], d*Cos[i] - w*Sin[i]} > }] > }, > {i, 0, 2 \[Pi], 2 \[Pi]/12} > ], -Clock[{2*\[Pi]/12, 2*\[Pi], 2*\[Pi]/11}, 2]], > White, Disk[{0, 0}, d*1.1]}, > ImageSize -> {250, 250} > ] > ] > ]; > > mydialog = CreateDialog[myflower, > Modal -> True, > WindowTitle -> "Working...", > WindowSize -> All, > WindowMargins -> Automatic, > Background -> White]; > nd = 1; > While[nd < 10, > Pause[1]; > nd++ > ] > NotebookClose[mydialog]; > > I hope someone else finds this useful too. looks like you are a person who would appreciate these small visual enhancements: mydialog = CreateDialog[ myflower, Modal -> True, WindowSize -> All, WindowMargins -> Automatic, WindowFrame -> "Frameless", WindowOpacity -> 0.75, WindowFloating -> True ] I think WindowOpacity will not work for all OS. For me the code you posted didn't work right away, and I think this is because the Module doesn't behave as you wanted. It think when stuffing constants into a Dynamic the use of With is usually the better choice: With[{ w = 0.22, bigD = 2, d = 1 }, Dynamic[...] ] hth, albert