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 |