Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #6061
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: How to generate the final result of variable definitions in |
| Date | 2011-10-31 11:50 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j8m22v$rmd$1@smc.vnet.net> (permalink) |
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@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*)
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: How to generate the final result of variable definitions in Bob Hanlon <hanlonr357@gmail.com> - 2011-10-31 11:50 +0000
csiph-web