[wxPython-users] Default wx.Choice() Value?
Christopher Barker
Chris.Barker at noaa.gov
Thu Dec 21 15:45:15 PST 2006
Rich Shepard wrote:
> All manipulations using these data are performed by middleware functions
> on records retrieved from the database. Getting the current value when a
> new
> model variable is entered, or an existing one modified, is the sole purpose
> of self.varSource.
If I understand that right, then you may not want self.varSource at all,
you could just call self.vsource.GetStringSelection() directly. That
kind of violates the "Law of Demeter", so an alternative is to make
self.varSource a property, that gets and sets the Choice selection, that
way the same data is only stored in one place.
That would look something like this:
def _setVarSource(self, s):
self.vsource.SetStringSelection(s)
def _getVarSource(self):
return self.vsource.GetStringSelection()
self.varSource = property(_getVarSource, _setVarSource)
**untested**
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the wxpython-users
mailing list