]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxChoice.py
2 from wxPython
. wx
import *
4 #---------------------------------------------------------------------------
6 class TestChoice ( wxPanel
):
7 def __init__ ( self
, parent
, log
):
9 wxPanel
.__ init
__ ( self
, parent
, - 1 )
11 sampleList
= [ 'zero' , 'one' , 'two' , 'three' , 'four' , 'five' ,
12 'six' , 'seven' , 'eight' ]
14 wxStaticText ( self
, - 1 , "This example uses the wxChoice control." ,
17 wxStaticText ( self
, - 1 , "Select one:" , wxPoint ( 15 , 50 ), wxSize ( 75 , 20 ))
18 wxChoice ( self
, 40 , ( 80 , 50 ), ( 95 , 125 ),
20 EVT_CHOICE ( self
, 40 , self
. EvtChoice
)
22 def EvtChoice ( self
, event
):
23 self
. log
. WriteText ( 'EvtChoice: %s \n ' % event
. GetString ())
25 #---------------------------------------------------------------------------
27 def runTest ( frame
, nb
, log
):
28 win
= TestChoice ( nb
, log
)
31 #---------------------------------------------------------------------------
45 A choice item is used to select one of a list of strings. Unlike a listbox, only the selection is visible until the user pulls down the menu of choices.
52 wxChoice(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "choice")
54 Constructor, creating and showing a choice.
59 parent = Parent window. Must not be NULL.
61 id = Window identifier. A value of -1 indicates a default value.
63 pos = Window position.
65 size = Window size. If the default size (-1, -1) is specified then the choice is sized appropriately.
67 n = Number of strings with which to initialise the choice control.
69 choices = An array of strings with which to initialise the choice control.
71 style = Window style. See wxChoice.
73 validator = Window validator.