MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Button Question

It works perfectly well if you paste the following in Mathematica 6.0
(choose to interpret the text!)

Cell[ButtonBox["Simulate", Active -> True,
   ButtonFunction -> (Needs["MultivariateStatistics`"];
       100, {1/6,1/6,1/6,1/6,1/6,1/6}], 1]]),
   ButtonEvaluator -> Automatic] // DisplayForm, "Output"] 

Thus avoid the quotes around 1/6. The arrow with colon (RuleDelayed) is
generated by :> . I do not think it is needed here. You could also try to
execute the following code

Button["Simulate", Needs["MultivariateStatistics`"];
       100, {1/6,1/6,1/6,1/6,1/6,1/6}], 1]]] 

(The printed line is then overwritten each time the button is pressed)

Best regards

Ingolf Dahl

-----Original Message-----
From: John [mailto:jwa0 at] 
Sent: 19 December 2007 10:11
To: mathgroup at
Subject: [mg84342] [mg84319] Button Question

The cell, pasted below, is in my notebook. When the cell is evaluated, It
prints a button, labeled simulate, but clicking on the button does not
print the six simulated integers that RandomInteger  computed.

The error message says that the list of probabilities, entered as shown
below, is not a probability distribution recognized by the system, but
{1/6,1/6,1/6,1/6,1/6,1/6} is a valid multinomial distribution.

ButtonEvaluator, not mispelled, is printed in red. The color red must be an
indication of an error of some kind, but I have no idea what it is.

Cell[ButtonBox["Simulate", Active -> True,
   ButtonFunction ->
       100, {"1", "/", "6", "1", "/", "6", "1", "/", "6", "1", "/",
        "6", "1", "/", "6", "1", "/", "6"}], 1]],
   ButtonEvaluator -> Automatic] // DisplayForm, "Output"],

In one example, I saw, the arrow between ButtonFunction and Print is short
and preceded by a colon. If if that notation is necessary, I don't know how
to do it.

Helpful advice will be appreciated .


  • Prev by Date: Re: FindRoot / Jacobian
  • Next by Date: Re: Re: Speeding Up Realtime Visualization
  • Previous by thread: Button Question
  • Next by thread: Re: Button Question