-------------- Original message ---------------------- From: Paul McNett <[EMAIL PROTECTED]> > Adrian Klaver wrote: > > > I am trying to set the BackColor of a button dynamically and not succeeding. > > I have a function saveColor() that returns u'red' and have: > > self.SaveBtn.DynamicBackColor = saveColor > > where self.saveColor returns u'red' > > If I do the following in the command window > > self.SaveBtn.DynamicBackColor > > I get > > u'red' > > The BackColor does not change. > > I can do self.SaveBtn.BackColor = u'red' and the BackColor changes. > > Any tips? > > If you print self.SaveBtn.DynamicBackColor, you should get something like: > > <bound method SaveBtn.saveColor at 0xbbdd0fe8> > > IOW, you should get the function back, not the return value of the > function. Make sure you are setting the dynamic property to the > function, and not the return value. It looks like you are doing this, > but please make sure you have: > > self.SaveBtn.DynamicBackColor = saveColor > and not > self.SaveBtn.DynamicBackColor = saveColor() > > I just made a quick test, and it works how it should on my end. > > Paul > I get it to work now by doing self.update() after self.SaveBtn.DynamicBackColor = self.saveColor To answer Ed's email I did use self.saveColor I just lost the self in the cut and paste. Not to get existential. So I guess the question now is where is update() normally called in Form navigation? -- Adrian Klaver [EMAIL PROTECTED]
_______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]
