From: Lenore H. <lh...@si...> - 2009-09-12 22:56:32
|
I'd like my buttons to change colors when they've received a button press. I can get an apparent color change by recreating the button. However, if I change the text , I see both texts stacked on top of each other, so I think I'm just piling up the buttons. I've tried using buttonname.color=color.newcolor without success. I have tried buttonname.visible=False del buttonname and the button doesn't disappear. So in general it's looking to me like buttons don't behave the way ordinary objects do. Is this correct? Lenore |
From: Bruce S. <Bru...@nc...> - 2009-09-13 14:28:15
|
Sigh. That module definitely needs work. If you look at controls.py you'll see that a button is constructed from 5 boxes and a label. Until and unless the controls module is improved, the only way to achieve the desired effect is to change these individual elements (e.g. buttonname.button.color = something). Ugh. Obviously a better scheme would be to change the button class to honor all desired changes, but here's a specific example within the present framework: from visual.controls import * s = True def switch(): global s if s: b.text = "Off" b.button.color = color.cyan else: b.text = "On" b.button.color = color.red s = not s c = controls() b = button(text="On", color=color.red, action=lambda: switch()) while 1: rate(100) c.interact() Bruce Sherwood Lenore Horner wrote: > I'd like my buttons to change colors when they've received a button > press. I can get an apparent color change by recreating the button. > However, if I change the text , I see both texts stacked on top of > each other, so I think I'm just piling up the buttons. I've tried using > > buttonname.color=color.newcolor > > without success. I have tried > > buttonname.visible=False > del buttonname > > and the button doesn't disappear. > > So in general it's looking to me like buttons don't behave the way > ordinary objects do. Is this correct? > > Lenore > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users |
From: Lenore H. <lh...@si...> - 2009-09-13 14:53:00
|
Ahah. I tried calling b.color not b.button.color. Thanks Lenore On Sep 13, 2009, at 09:27 , Bruce Sherwood wrote: > Sigh. That module definitely needs work. If you look at controls.py > you'll see that a button is constructed from 5 boxes and a label. > Until > and unless the controls module is improved, the only way to achieve > the > desired effect is to change these individual elements (e.g. > buttonname.button.color = something). Ugh. Obviously a better scheme > would be to change the button class to honor all desired changes, but > here's a specific example within the present framework: > > from visual.controls import * > > s = True > > def switch(): > global s > if s: > b.text = "Off" > b.button.color = color.cyan > else: > b.text = "On" > b.button.color = color.red > s = not s > > c = controls() > b = button(text="On", color=color.red, action=lambda: switch()) > while 1: > rate(100) > c.interact() > > Bruce Sherwood > > Lenore Horner wrote: >> I'd like my buttons to change colors when they've received a button >> press. I can get an apparent color change by recreating the button. >> However, if I change the text , I see both texts stacked on top of >> each other, so I think I'm just piling up the buttons. I've tried >> using >> >> buttonname.color=color.newcolor >> >> without success. I have tried >> >> buttonname.visible=False >> del buttonname >> >> and the button doesn't disappear. >> >> So in general it's looking to me like buttons don't behave the way >> ordinary objects do. Is this correct? >> >> Lenore >> >> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal Reports >> 2008 30-Day >> trial. Simplify your report design, integration and deployment - >> and focus on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> Visualpython-users mailing list >> Vis...@li... >> https://lists.sourceforge.net/lists/listinfo/visualpython-users > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > trial. Simplify your report design, integration and deployment - and > focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users |
From: Lenore H. <lh...@si...> - 2009-11-28 02:47:30
|
I've made some vpython simulations of varying degrees of sophistication. If you are interested, you can find them here. Bruce, I don't know how things get into the contributed programs, but if you think any are worthy, you are welcome to post them there. Iterative set of simulations looking at falling drops without and then with air resistance. A simulation with extensive user controls for air resistance in projectile motion. Thank you, Bruce, for your help with this. This requires the posted modified controls module. A simulation of Newton's cannon with too small a velocity in comparison to falling-through-the-center-of-the-Earth in once case assuming all Earth's mass is at the center and in the other assuming a uniform density for the Earth. (All of this assumes a spherical Earth.) Lenore Horner physics SIUE |
From: Symion <kn...@ip...> - 2009-11-28 03:20:12
|
Lenore Horner wrote: > I've made some vpython simulations of varying degrees of > sophistication. If you are interested, you can find them here > <http://www.siue.edu/%7Elhorner/VPython/VPython.html>. Bruce, I > don't know how things get into the contributed programs, but if you > think any are worthy, you are welcome to post them there. > > Iterative set of simulations looking at falling drops without and then > with air resistance. > > A simulation with extensive user controls for air resistance in > projectile motion. Thank you, Bruce, for your help with this. This > requires the posted modified controls module. > > A simulation of Newton's cannon with too small a velocity in > comparison to falling-through-the-center-of-the-Earth in once case > assuming all Earth's mass is at the center and in the other assuming a > uniform density for the Earth. (All of this assumes a spherical Earth.) > > Lenore Horner > physics > SIUE > Hi there Lenore, Nice to see some open source programs being shared around. Just a slight problem with a link in your web page force drops to separate vpython source <http://www.siue.edu/%7Elhorner/VPython/drops-falling-through-air/drops-splat.py> has the following extraneous info attached. %7Elhorner/VPython/drops-falling-through-air/drops-splat.py%3Eair%20resistance%20plus%20going%20splat%3C/a%3E%3Cp%3EIf%20you%20run%20a%20few%20of%20the%20last%20two%20simulations,%20you%20will%20see%20things%20behaving%20more%20like%20soap%20bubbles%20than%20any%20ball%20or%20rain%20drop%20I%20ever%20saw.%20%20That%20is%20fixed%20here.%3C/p%3E%3Ca%20href= Symion |