[wxPython-users] 2 questions in wxpython

Rich Shepard rshepard at appl-ecosys.com
Tue Dec 4 08:55:12 PST 2007


On Tue, 4 Dec 2007, Stephen Hansen wrote:

>> If nothing is selected I want to give error message. So how can I verify
>> that.

> Use GetSelection() -- it will return -1 if nothing is selected. You'll
> find GetValue() tends to be used in controls like wx.TextCtrl that have a
> single, set or current 'value', and GetSelection() is for controls where
> they are presented with a choice from which a selection is made.

   You can also use the wx.Validator() to ensure that the selection is not
blank. Detailed code in the wPIA book.

Rich

-- 
Richard B. Shepard, Ph.D.               |  Integrity            Credibility
Applied Ecosystem Services, Inc.        |            Innovation
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863




More information about the wxpython-users mailing list