I want all of those objects to be check boxes (trade, bonus, soldiers, etc)

self.box = wxCheckListBox ( self.panel, 100, size = ( 250, 200 ), choices = self.trade, style = wxLB_HSCROLL )

In this line where I define the choices, I can only put one (self.trade) if I do any more it gets messed up. I tried choices = self.trade, self.bonus, etc. I've also tried choices = (self.trade, self.bonus, etc.) nothing works. what am I doing wrong? to clerify what I want, this is an audit program for a game. I need there to be checkboxes for these items, and based on if it's checked or not display something ex. if thanks it checked (print "Decommission tanks) if not checked don't print anything

from wxPython.wx import *

class Window ( wxFrame ):

   def __init__ ( self ):

      wxFrame.__init__ ( self, None, -1, 'Audit', size = ( 300, 300 ) )

      # Create a status bar

      self.CreateStatusBar()

      # Create a panel

      self.panel = wxPanel ( self, -1 )

      # Create a label

      self.label = wxStaticText ( self.panel, -1, 'Nation Audit:' )

      # Define a list of items to place in the wxCheckListBox

      self.trade = [ 'Trade' ]
      self.bonus = [ 'Bonus Resources' ]
      self.tech15 = [ 'Technology above 15' ]
      self.tech51 = [ 'Tech ratio better than 5:1' ]
      self.soldier = [ 'Soldiers greater than 20%' ]
      self.soldier60 = [ 'Soldiers less than 60%' ]
      self.defcon = [ 'Defcon 5 (unless in war)' ]
      self.peace = [ 'Not in peace mode' ]
      self.government = [ 'Government' ]
      self.tank = [ 'Tanks' ]
      self.cm = [ 'Cruise Missles' ]
     
      # Create a wxCheckListBox

      self.box = wxCheckListBox ( self.panel, 100, size = ( 250, 200 ), choices = self.trade, style = wxLB_HSCROLL )

      # Hook up an event handling method

      EVT_CHECKLISTBOX ( self.panel, 100, self.clickHandler )

      # Create a button

      self.button = wxButton ( self.panel, 200, 'Audit' )

      # Hook up an event handling method

      EVT_BUTTON ( self.panel, 200, self.buttonHandler )

      # Create two sizers to make everything pretty

      # The usual

      self.vertical = wxBoxSizer ( wxVERTICAL )

      self.vertical.Add ( ( 0, 0 ), 1 )

      self.vertical.Add ( self.label, 0, wxALIGN_CENTER )

      self.vertical.Add ( ( 5, 5 ), 0 )

      self.vertical.Add ( self.box, 0, wxALIGN_CENTER )

      self.vertical.Add ( ( 5, 5 ), 0 )

      self.vertical.Add ( self.button, 0, wxALIGN_CENTER )

      self.vertical.Add ( ( 0, 0 ), 1 )

      self.horizontal = wxBoxSizer ( wxHORIZONTAL )

      self.horizontal.Add ( ( 0, 0 ), 1 )

      self.horizontal.Add ( self.vertical, 0, wxALIGN_CENTER )

      self.horizontal.Add ( ( 0, 0 ), 1 )

      # Attach the sizer

      self.panel.SetSizerAndFit ( self.horizontal )

      self.Show ( True )

   # This method is called when an item is clicked

   def clickHandler ( self, event ):

      if self.box.IsChecked ( event.GetSelection() ):

         message = ''

      else:

         message = ''

      # Update the status bar of the window

      self.SetStatusText ( self.box.GetString ( event.GetSelection() ) + message )

   # This method will be called when the button is clicked

   def buttonHandler ( self, event ):

      message = 'Nation Audit Final:'

      # Check to see what has been selected and what has not

      x = 0

      for choice in self.trade:
         if self.box.IsChecked ( x ):
            print 
         else:
            print 'Find More Trades'

      for choice in self.bonus:
         if self.box.IsChecked ( x ):
            print
         else:
            print 'Restructure your trades'

            
      for choice in self.tech15:
         if self.box.IsChecked ( x ):
            print
         else:
            print 'You should always have more than 15 tech'

      for choice in self.tech51:
         if self.box.IsChecked ( x ):
            print
         else:
            print 'Buy tech till ratio is over 5:1'

      for choice in self.soldier:
         if self.box.IsChecked ( x ):
            print
         else:
            print 'Buy more soldiers until it is 20% of pop'

      for choice in self.soldier60:
         if self.box.IsChecked ( x ):
            print
         else:
            print 'Sell soldiers'
               
      for choice in self.defcon:
         if self.box.IsChecked ( x ):
            print
         else:
            print 'Change defcon level to 5 unless in war'
            

      for choice in self.peace:
         if self.box.IsChecked ( x ):
            print
         else:
            print 'Make war an option'

      for choice in self.government:
         if self.box.IsChecked ( x ):
            print
         else:
            print 'Change government type'

      for choice in self.tank:
         if self.box.IsChecked ( x ):
            print 'Decommission tanks'
         else:
            print

      for choice in self.cm:
         if self.box.IsChecked ( x ):
            print 'Decommission CM'
         else:
            print

            message = message + '\n' + choice

         x = x + 1

      # Display a dialog

      dialog = wxMessageDialog ( self, message, 'The audit is complete', style = wxOK )

      dialog.ShowModal()

      dialog.Destroy()

application = wxPySimpleApp()

Window()

application.MainLoop()

Use a list with them all in. And you only need strings, not checkBox Items

self.box = wxCheckListBox ( self.panel, 100, size = ( 250, 200 ), choices = ["One",'Two','Three'], style = wx.LB_HSCROLL )
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.