]>
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 self
. ch
= wxChoice ( self
, 40 , ( 80 , 50 ), ( 95 , 125 ),
20 EVT_CHOICE ( self
, 40 , self
. EvtChoice
)
23 def EvtChoice ( self
, event
):
24 self
. log
. WriteText ( 'EvtChoice: %s \n ' % event
. GetString ())
25 self
. ch
. Append ( "A new item" )
28 #---------------------------------------------------------------------------
30 def runTest ( frame
, nb
, log
):
31 win
= TestChoice ( nb
, log
)
34 #---------------------------------------------------------------------------
48 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.