Renamed demo modules to be wx-less.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25064 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		
							
								
								
									
										60
									
								
								wxPython/demo/Choice.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								wxPython/demo/Choice.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,60 @@
 | 
			
		||||
# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
 | 
			
		||||
#
 | 
			
		||||
# o Updated for wx namespace
 | 
			
		||||
# 
 | 
			
		||||
 | 
			
		||||
import  wx
 | 
			
		||||
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
class TestChoice(wx.Panel):
 | 
			
		||||
    def __init__(self, parent, log):
 | 
			
		||||
        self.log = log
 | 
			
		||||
        wx.Panel.__init__(self, parent, -1)
 | 
			
		||||
 | 
			
		||||
        sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
 | 
			
		||||
                      'six', 'seven', 'eight']
 | 
			
		||||
 | 
			
		||||
        wx.StaticText(self, -1, "This example uses the wxChoice control.", (15, 10))
 | 
			
		||||
        wx.StaticText(self, -1, "Select one:", (15, 50), (75, 20))
 | 
			
		||||
        self.ch = wx.Choice(self, -1, (80, 50), choices = sampleList)
 | 
			
		||||
        self.Bind(wx.EVT_CHOICE, self.EvtChoice, self.ch)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    def EvtChoice(self, event):
 | 
			
		||||
        self.log.WriteText('EvtChoice: %s\n' % event.GetString())
 | 
			
		||||
        self.ch.Append("A new item")
 | 
			
		||||
        
 | 
			
		||||
        if event.GetString() == 'one':
 | 
			
		||||
            self.log.WriteText('Well done!\n')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
def runTest(frame, nb, log):
 | 
			
		||||
    win = TestChoice(nb, log)
 | 
			
		||||
    return win
 | 
			
		||||
 | 
			
		||||
#---------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
overview = """
 | 
			
		||||
A Choice control is used to select one of a list of strings. Unlike a listbox, 
 | 
			
		||||
only the current selection is visible until the user pulls down the menu of 
 | 
			
		||||
choices.
 | 
			
		||||
 | 
			
		||||
This demo illustrates how to set up the Choice control and how to extract the
 | 
			
		||||
selected choice once it is selected. 
 | 
			
		||||
 | 
			
		||||
Note that the syntax of the constructor is different than the C++ implementation.
 | 
			
		||||
The number of choices and the choice array are consilidated into one python 
 | 
			
		||||
<code>list</code>.
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    import sys,os
 | 
			
		||||
    import run
 | 
			
		||||
    run.main(['', os.path.basename(sys.argv[0])])
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user