Re: How to generate the final result of variable definitions in
- To: mathgroup at smc.vnet.net
- Subject: [mg122524] Re: How to generate the final result of variable definitions in
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Mon, 31 Oct 2011 06:49:30 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
This uses the shapes as buttons and allows a choice of colors: polygon[Infinity] = Disk[]; polygon[n_Integer?Positive] := Polygon[{Cos[#], Sin[#]} & /@ (Pi (Range[1/n, 2, 2/n] + {0, 0, 1/6, 0, 11/10, 1/6}[[n]]))] Manipulate[DynamicModule[{color = Green}, Column[{ Row[{ Style["Shape Color", FontFamily -> "Helvetica", 12], Spacer[6], ColorSlider[Dynamic[color], ImageSize -> 180]}], Dynamic[Graphics[{color, shape}]] }]], {{shape, polygon[4], Style["Shape Type", FontFamily -> "Helvetica", 12]}, Table[ polygon[n] -> Graphics[polygon[n], ImageSize -> 30], {n, {3, 4, 5, 6, Infinity}}]}, Paneled -> False] Bob Hanlon On Sun, Oct 30, 2011 at 5:22 AM, Mark <big.dog1 at att.net> wrote: > Hello. I am new to Mathematica and currently learning its syntax. > > The below commands generate a rectangle, circle and radio button bar control. > > My question is how do I encorporate the below commands to get a window area showing the radio button bar so that when you press one of the buttons it will draw the appropriate shape. > I understand that an "If" command is needed but do not know what to put all this in to get the final result. > > Many thanks in advance > ---------------------------------------- > > box = Graphics[{Thick, Green, Rectangle[{0, -1}, {2, 1}]}];(*Rectangle definition*) > > oval = Graphics[{Red, Disk[]}];(*Circle definition*) > > shape1 = Row[{"Shape Type: ", Control[{{bt, 1}, {1 -> " Rectangle ", 2 -> " Circle "}, ControlType -> RadioButtonBar}]}];(*Radio button bar definition*) >