Re: about the use of button
- To: mathgroup at smc.vnet.net
- Subject: [mg115210] Re: about the use of button
- From: "W. Craig Carter" <ccarter at mit.edu>
- Date: Tue, 4 Jan 2011 04:26:40 -0500 (EST)
Hello Yang,
Try this:
----
carWeight == tareWeight;
personNumber == 0;
Row[{Button["A person enters", {carWeight +== 60, personNumber++}],
Dynamic[{carWeight, personNumber}]}]
-----
You must avoid underscores "_" in variable names. It is a good habit to use an lower case letter to begin each variable name. Notice that Dynamic sits outside the button--that is the only place you need to see the current (i. e., dynamic) values.
Craig
On 28 Dec, 2010, at 6:51 AM, yang wrote:
> Button["A person enters",
> {Dynamic[car_weight+==60],Dynamic[person_number++}]]