My error is ">>>
Traceback (most recent call last):
File "C:\Python25\Books_per_month1AP.py", line 203, in <module>
Window()
File "C:\Python25\Books_per_month1AP.py", line 7, in __init__
wxFrame.__init__ ( self, None, -1, 'Audit', size = ( 300, 300 ) )
File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\_windows.py", line 505, in __init__
_windows_.Frame_swiginit(self,_windows_.new_Frame(*args, **kwargs))
PyNoAppError: The wx.App object must be created first!
>>> "

What is wrong with this!?

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 )
      self.box = wxCheckListBox ( self.panel, 100, size = ( 250, 200 ), choices = self.bonus, style = wxLB_HSCROLL )
      self.box = wxCheckListBox ( self.panel, 100, size = ( 250, 200 ), choices = self.tech15, style = wxLB_HSCROLL )
      self.box = wxCheckListBox ( self.panel, 100, size = ( 250, 200 ), choices = self.tech51, style = wxLB_HSCROLL )
      self.box = wxCheckListBox ( self.panel, 100, size = ( 250, 200 ), choices = self.soldier, style = wxLB_HSCROLL )
      self.box = wxCheckListBox ( self.panel, 100, size = ( 250, 200 ), choices = self.soldier60, style = wxLB_HSCROLL )
      self.box = wxCheckListBox ( self.panel, 100, size = ( 250, 200 ), choices = self.defcon, style = wxLB_HSCROLL )
      self.box = wxCheckListBox ( self.panel, 100, size = ( 250, 200 ), choices = self.peace, style = wxLB_HSCROLL )
      self.box = wxCheckListBox ( self.panel, 100, size = ( 250, 200 ), choices = self.government, style = wxLB_HSCROLL )
      self.box = wxCheckListBox ( self.panel, 100, size = ( 250, 200 ), choices = self.tank, style = wxLB_HSCROLL )
      self.box = wxCheckListBox ( self.panel, 100, size = ( 250, 200 ), choices = self.cm, 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()

Google is your friend.
http://www.google.hu/search?q=wxPySimpleApp(&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:hu-HU:unofficial&client=firefox-a

First url I get:
http://www.wxpython.org/docs/api/wx.PySimpleApp-class.html

which says in the example:

app = wx.PySimpleApp()
frame = wx.Frame(None, title='Hello World')
frame.Show()
app.MainLoop()

So that in your code the last lines will look like:

application = wxPySimpleApp()
w=Window()
w.Show()
application.MainLoop()

I hope this helps.

Please post the minimal code which produces the problem.
Please don't make topic with titles like 'I need help', 'Error?', 'Dunno what to do' etc...
Please use google, or any other search tool.

commented: good points! +11
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.