-       """ Standard constructor.
-
-           'parent', 'id' and 'title' are all passed to the standard wxFrame
-           constructor.  'fileName' is the name and path of a saved file to
-           load into this frame, if any.
-       """
-        wxFrame.__init__(self, parent, id, title,
-                        style = wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS |
-                                wxNO_FULL_REPAINT_ON_RESIZE)
-
-       # Setup our menu bar.
-
-       menuBar = wxMenuBar()
-
-       self.fileMenu = wxMenu()
-       self.fileMenu.Append(wxID_NEW,    "New\tCTRL-N")
-       self.fileMenu.Append(wxID_OPEN,   "Open...\tCTRL-O")
-       self.fileMenu.Append(wxID_CLOSE,  "Close\tCTRL-W")
-       self.fileMenu.AppendSeparator()
-       self.fileMenu.Append(wxID_SAVE,   "Save\tCTRL-S")
-       self.fileMenu.Append(wxID_SAVEAS, "Save As...")
-       self.fileMenu.Append(wxID_REVERT, "Revert...")
-       self.fileMenu.AppendSeparator()
-       self.fileMenu.Append(wxID_EXIT,   "Quit\tCTRL-Q")
-
-       menuBar.Append(self.fileMenu, "File")
-
-       self.editMenu = wxMenu()
-       self.editMenu.Append(menu_UNDO,          "Undo\tCTRL-Z")
-       self.editMenu.AppendSeparator()
-       self.editMenu.Append(menu_SELECT_ALL,    "Select All\tCTRL-A")
-       self.editMenu.AppendSeparator()
-       self.editMenu.Append(menu_DUPLICATE,     "Duplicate\tCTRL-D")
-       self.editMenu.Append(menu_EDIT_TEXT,     "Edit...\tCTRL-E")
-       self.editMenu.Append(menu_DELETE,        "Delete\tDEL")
-
-       menuBar.Append(self.editMenu, "Edit")
-
-       self.toolsMenu = wxMenu()
-       self.toolsMenu.Append(menu_SELECT,  "Selection", kind=wxITEM_CHECK)
-       self.toolsMenu.Append(menu_LINE,    "Line",      kind=wxITEM_CHECK)
-       self.toolsMenu.Append(menu_RECT,    "Rectangle", kind=wxITEM_CHECK)
-       self.toolsMenu.Append(menu_ELLIPSE, "Ellipse",   kind=wxITEM_CHECK)
-       self.toolsMenu.Append(menu_TEXT,    "Text",      kind=wxITEM_CHECK)
-
-       menuBar.Append(self.toolsMenu, "Tools")
-
-       self.objectMenu = wxMenu()
-       self.objectMenu.Append(menu_MOVE_FORWARD,  "Move Forward")
-       self.objectMenu.Append(menu_MOVE_TO_FRONT, "Move to Front\tCTRL-F")
-       self.objectMenu.Append(menu_MOVE_BACKWARD, "Move Backward")
-       self.objectMenu.Append(menu_MOVE_TO_BACK,  "Move to Back\tCTRL-B")
-
-       menuBar.Append(self.objectMenu, "Object")
-
-       self.helpMenu = wxMenu()
-       self.helpMenu.Append(menu_ABOUT, "About pySketch...")
-
-       menuBar.Append(self.helpMenu, "Help")
-
-       self.SetMenuBar(menuBar)
-
-       # Create our toolbar.
-
-       self.toolbar = self.CreateToolBar(wxTB_HORIZONTAL |
-                                         wxNO_BORDER | wxTB_FLAT)
-
-       self.toolbar.AddSimpleTool(wxID_NEW,
-                                  wxBitmap("images/new.bmp",
-                                           wxBITMAP_TYPE_BMP),
-                                  "New")
-       self.toolbar.AddSimpleTool(wxID_OPEN,
-                                  wxBitmap("images/open.bmp",
-                                           wxBITMAP_TYPE_BMP),
-                                  "Open")
-       self.toolbar.AddSimpleTool(wxID_SAVE,
-                                  wxBitmap("images/save.bmp",
-                                           wxBITMAP_TYPE_BMP),
-                                  "Save")
-       self.toolbar.AddSeparator()
-       self.toolbar.AddSimpleTool(menu_UNDO,
-                                  wxBitmap("images/undo.bmp",
-                                           wxBITMAP_TYPE_BMP),
-                                  "Undo")
-       self.toolbar.AddSeparator()
-       self.toolbar.AddSimpleTool(menu_DUPLICATE,
-                                  wxBitmap("images/duplicate.bmp",
-                                           wxBITMAP_TYPE_BMP),
-                                  "Duplicate")
-       self.toolbar.AddSeparator()
-       self.toolbar.AddSimpleTool(menu_MOVE_FORWARD,
-                                  wxBitmap("images/moveForward.bmp",
-                                           wxBITMAP_TYPE_BMP),
-                                  "Move Forward")
-       self.toolbar.AddSimpleTool(menu_MOVE_BACKWARD,
-                                  wxBitmap("images/moveBack.bmp",
-                                           wxBITMAP_TYPE_BMP),
-                                  "Move Backward")
-
-       self.toolbar.Realize()
-
-       # Associate each menu/toolbar item with the method that handles that
-       # item.
-
-       EVT_MENU(self, wxID_NEW,    self.doNew)
-       EVT_MENU(self, wxID_OPEN,   self.doOpen)
-       EVT_MENU(self, wxID_CLOSE,  self.doClose)
-       EVT_MENU(self, wxID_SAVE,   self.doSave)
-       EVT_MENU(self, wxID_SAVEAS, self.doSaveAs)
-       EVT_MENU(self, wxID_REVERT, self.doRevert)
-       EVT_MENU(self, wxID_EXIT,   self.doExit)
-
-       EVT_MENU(self, menu_UNDO,          self.doUndo)
-       EVT_MENU(self, menu_SELECT_ALL,    self.doSelectAll)
-       EVT_MENU(self, menu_DUPLICATE,     self.doDuplicate)
-       EVT_MENU(self, menu_EDIT_TEXT,     self.doEditText)
-       EVT_MENU(self, menu_DELETE,        self.doDelete)
-
-       EVT_MENU(self, menu_SELECT,  self.doChooseSelectTool)
-       EVT_MENU(self, menu_LINE,    self.doChooseLineTool)
-       EVT_MENU(self, menu_RECT,    self.doChooseRectTool)
-       EVT_MENU(self, menu_ELLIPSE, self.doChooseEllipseTool)
-       EVT_MENU(self, menu_TEXT,    self.doChooseTextTool)
-
-       EVT_MENU(self, menu_MOVE_FORWARD,  self.doMoveForward)
-       EVT_MENU(self, menu_MOVE_TO_FRONT, self.doMoveToFront)
-       EVT_MENU(self, menu_MOVE_BACKWARD, self.doMoveBackward)
-       EVT_MENU(self, menu_MOVE_TO_BACK,  self.doMoveToBack)
-
-       EVT_MENU(self, menu_ABOUT, self.doShowAbout)
-
-       # Install our own method to handle closing the window.  This allows us
-       # to ask the user if he/she wants to save before closing the window, as
-       # well as keeping track of which windows are currently open.
-
-       EVT_CLOSE(self, self.doClose)
-
-       # Install our own method for handling keystrokes.  We use this to let
-       # the user move the selected object(s) around using the arrow keys.
-
-       EVT_CHAR_HOOK(self, self.onKeyEvent)
-
-       # Setup our top-most panel.  This holds the entire contents of the
-       # window, excluding the menu bar.
-
-       self.topPanel = wxPanel(self, -1, style=wxSIMPLE_BORDER)
-
-       # Setup our tool palette, with all our drawing tools and option icons.
-
-       self.toolPalette = wxBoxSizer(wxVERTICAL)
-
-       self.selectIcon  = ToolPaletteIcon(self.topPanel, id_SELECT,
-                                          "select", "Selection Tool")
-       self.lineIcon    = ToolPaletteIcon(self.topPanel, id_LINE,
-                                          "line", "Line Tool")
-       self.rectIcon    = ToolPaletteIcon(self.topPanel, id_RECT,
-                                          "rect", "Rectangle Tool")
-       self.ellipseIcon = ToolPaletteIcon(self.topPanel, id_ELLIPSE,
-                                          "ellipse", "Ellipse Tool")
-       self.textIcon    = ToolPaletteIcon(self.topPanel, id_TEXT,
-                                          "text", "Text Tool")
-
-       toolSizer = wxGridSizer(0, 2, 5, 5)
-       toolSizer.Add(self.selectIcon)
-       toolSizer.Add(0, 0) # Gap to make tool icons line up nicely.
-       toolSizer.Add(self.lineIcon)
-       toolSizer.Add(self.rectIcon)
-       toolSizer.Add(self.ellipseIcon)
-       toolSizer.Add(self.textIcon)
-
-       self.optionIndicator = ToolOptionIndicator(self.topPanel)
-       self.optionIndicator.SetToolTip(
-               wxToolTip("Shows Current Pen/Fill/Line Size Settings"))
-
-       optionSizer = wxBoxSizer(wxHORIZONTAL)
-
-       self.penOptIcon  = ToolPaletteIcon(self.topPanel, id_PEN_OPT,
-                                          "penOpt", "Set Pen Colour")
-       self.fillOptIcon = ToolPaletteIcon(self.topPanel, id_FILL_OPT,
-                                          "fillOpt", "Set Fill Colour")
-       self.lineOptIcon = ToolPaletteIcon(self.topPanel, id_LINE_OPT,
-                                          "lineOpt", "Set Line Size")
-
-       margin = wxLEFT | wxRIGHT
-       optionSizer.Add(self.penOptIcon,  0, margin, 1)
-       optionSizer.Add(self.fillOptIcon, 0, margin, 1)
-       optionSizer.Add(self.lineOptIcon, 0, margin, 1)
-
-       margin = wxTOP | wxLEFT | wxRIGHT | wxALIGN_CENTRE
-       self.toolPalette.Add(toolSizer,            0, margin, 5)
-       self.toolPalette.Add(0, 0,                 0, margin, 5) # Spacer.
-       self.toolPalette.Add(self.optionIndicator, 0, margin, 5)
-       self.toolPalette.Add(optionSizer,          0, margin, 5)
+        """ Standard constructor.
+
+            'parent', 'id' and 'title' are all passed to the standard wx.Frame
+            constructor.  'fileName' is the name and path of a saved file to
+            load into this frame, if any.
+        """
+        wx.Frame.__init__(self, parent, id, title,
+                         style = wx.DEFAULT_FRAME_STYLE | wx.WANTS_CHARS |
+                                 wx.NO_FULL_REPAINT_ON_RESIZE)
+
+        # Setup our menu bar.
+
+        menuBar = wx.MenuBar()
+
+        self.fileMenu = wx.Menu()
+        self.fileMenu.Append(wx.ID_NEW,    "New\tCTRL-N")
+        self.fileMenu.Append(wx.ID_OPEN,   "Open...\tCTRL-O")
+        self.fileMenu.Append(wx.ID_CLOSE,  "Close\tCTRL-W")
+        self.fileMenu.AppendSeparator()
+        self.fileMenu.Append(wx.ID_SAVE,   "Save\tCTRL-S")
+        self.fileMenu.Append(wx.ID_SAVEAS, "Save As...")
+        self.fileMenu.Append(wx.ID_REVERT, "Revert...")
+        self.fileMenu.AppendSeparator()
+        self.fileMenu.Append(wx.ID_EXIT,   "Quit\tCTRL-Q")
+
+        menuBar.Append(self.fileMenu, "File")
+
+        self.editMenu = wx.Menu()
+        self.editMenu.Append(menu_UNDO,          "Undo\tCTRL-Z")
+        self.editMenu.AppendSeparator()
+        self.editMenu.Append(menu_SELECT_ALL,    "Select All\tCTRL-A")
+        self.editMenu.AppendSeparator()
+        self.editMenu.Append(menu_DUPLICATE,     "Duplicate\tCTRL-D")
+        self.editMenu.Append(menu_EDIT_TEXT,     "Edit...\tCTRL-E")
+        self.editMenu.Append(menu_DELETE,        "Delete\tDEL")
+
+        menuBar.Append(self.editMenu, "Edit")
+
+        self.toolsMenu = wx.Menu()
+        self.toolsMenu.Append(menu_SELECT,  "Selection", kind=wx.ITEM_CHECK)
+        self.toolsMenu.Append(menu_LINE,    "Line",      kind=wx.ITEM_CHECK)
+        self.toolsMenu.Append(menu_RECT,    "Rectangle", kind=wx.ITEM_CHECK)
+        self.toolsMenu.Append(menu_ELLIPSE, "Ellipse",   kind=wx.ITEM_CHECK)
+        self.toolsMenu.Append(menu_TEXT,    "Text",      kind=wx.ITEM_CHECK)
+
+        menuBar.Append(self.toolsMenu, "Tools")
+
+        self.objectMenu = wx.Menu()
+        self.objectMenu.Append(menu_MOVE_FORWARD,  "Move Forward")
+        self.objectMenu.Append(menu_MOVE_TO_FRONT, "Move to Front\tCTRL-F")
+        self.objectMenu.Append(menu_MOVE_BACKWARD, "Move Backward")
+        self.objectMenu.Append(menu_MOVE_TO_BACK,  "Move to Back\tCTRL-B")
+
+        menuBar.Append(self.objectMenu, "Object")
+
+        self.helpMenu = wx.Menu()
+        self.helpMenu.Append(menu_ABOUT, "About pySketch...")
+
+        menuBar.Append(self.helpMenu, "Help")
+
+        self.SetMenuBar(menuBar)
+
+        # Create our toolbar.
+
+        self.toolbar = self.CreateToolBar(wx.TB_HORIZONTAL |
+                                          wx.NO_BORDER | wx.TB_FLAT)
+
+        self.toolbar.AddSimpleTool(wx.ID_NEW,
+                                   wx.Bitmap("images/new.bmp",
+                                            wx.BITMAP_TYPE_BMP),
+                                   "New")
+        self.toolbar.AddSimpleTool(wx.ID_OPEN,
+                                   wx.Bitmap("images/open.bmp",
+                                            wx.BITMAP_TYPE_BMP),
+                                   "Open")
+        self.toolbar.AddSimpleTool(wx.ID_SAVE,
+                                   wx.Bitmap("images/save.bmp",
+                                            wx.BITMAP_TYPE_BMP),
+                                   "Save")
+        self.toolbar.AddSeparator()
+        self.toolbar.AddSimpleTool(menu_UNDO,
+                                   wx.Bitmap("images/undo.bmp",
+                                            wx.BITMAP_TYPE_BMP),
+                                   "Undo")
+        self.toolbar.AddSeparator()
+        self.toolbar.AddSimpleTool(menu_DUPLICATE,
+                                   wx.Bitmap("images/duplicate.bmp",
+                                            wx.BITMAP_TYPE_BMP),
+                                   "Duplicate")
+        self.toolbar.AddSeparator()
+        self.toolbar.AddSimpleTool(menu_MOVE_FORWARD,
+                                   wx.Bitmap("images/moveForward.bmp",
+                                            wx.BITMAP_TYPE_BMP),
+                                   "Move Forward")
+        self.toolbar.AddSimpleTool(menu_MOVE_BACKWARD,
+                                   wx.Bitmap("images/moveBack.bmp",
+                                            wx.BITMAP_TYPE_BMP),
+                                   "Move Backward")
+
+        self.toolbar.Realize()
+
+        # Associate each menu/toolbar item with the method that handles that
+        # item.
+        menuHandlers = [
+        (wx.ID_NEW,    self.doNew),
+        (wx.ID_OPEN,   self.doOpen),
+        (wx.ID_CLOSE,  self.doClose),
+        (wx.ID_SAVE,   self.doSave),
+        (wx.ID_SAVEAS, self.doSaveAs),
+        (wx.ID_REVERT, self.doRevert),
+        (wx.ID_EXIT,   self.doExit),
+
+        (menu_UNDO,          self.doUndo),
+        (menu_SELECT_ALL,    self.doSelectAll),
+        (menu_DUPLICATE,     self.doDuplicate),
+        (menu_EDIT_TEXT,     self.doEditText),
+        (menu_DELETE,        self.doDelete),
+
+        (menu_SELECT,  self.doChooseSelectTool),
+        (menu_LINE,    self.doChooseLineTool),
+        (menu_RECT,    self.doChooseRectTool),
+        (menu_ELLIPSE, self.doChooseEllipseTool),
+        (menu_TEXT,    self.doChooseTextTool),
+
+        (menu_MOVE_FORWARD,  self.doMoveForward),
+        (menu_MOVE_TO_FRONT, self.doMoveToFront),
+        (menu_MOVE_BACKWARD, self.doMoveBackward),
+        (menu_MOVE_TO_BACK,  self.doMoveToBack),
+
+        (menu_ABOUT, self.doShowAbout)]
+        for combo in menuHandlers:
+                id, handler = combo
+                self.Bind(wx.EVT_MENU, handler, id = id)
+                
+        
+        # Install our own method to handle closing the window.  This allows us
+        # to ask the user if he/she wants to save before closing the window, as
+        # well as keeping track of which windows are currently open.
+
+        self.Bind(wx.EVT_CLOSE, self.doClose)
+
+        # Install our own method for handling keystrokes.  We use this to let
+        # the user move the selected object(s) around using the arrow keys.
+
+        self.Bind(wx.EVT_CHAR_HOOK, self.onKeyEvent)
+
+        # Setup our top-most panel.  This holds the entire contents of the
+        # window, excluding the menu bar.
+
+        self.topPanel = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
+
+        # Setup our tool palette, with all our drawing tools and option icons.
+
+        self.toolPalette = wx.BoxSizer(wx.VERTICAL)
+
+        self.selectIcon  = ToolPaletteIcon(self.topPanel, id_SELECT,
+                                           "select", "Selection Tool")
+        self.lineIcon    = ToolPaletteIcon(self.topPanel, id_LINE,
+                                           "line", "Line Tool")
+        self.rectIcon    = ToolPaletteIcon(self.topPanel, id_RECT,
+                                           "rect", "Rectangle Tool")
+        self.ellipseIcon = ToolPaletteIcon(self.topPanel, id_ELLIPSE,
+                                           "ellipse", "Ellipse Tool")
+        self.textIcon    = ToolPaletteIcon(self.topPanel, id_TEXT,
+                                           "text", "Text Tool")
+
+        toolSizer = wx.GridSizer(0, 2, 5, 5)
+        toolSizer.Add(self.selectIcon)
+        toolSizer.Add((0, 0)) # Gap to make tool icons line up nicely.
+        toolSizer.Add(self.lineIcon)
+        toolSizer.Add(self.rectIcon)
+        toolSizer.Add(self.ellipseIcon)
+        toolSizer.Add(self.textIcon)
+
+        self.optionIndicator = ToolOptionIndicator(self.topPanel)
+        self.optionIndicator.SetToolTip(
+                wx.ToolTip("Shows Current Pen/Fill/Line Size Settings"))
+
+        optionSizer = wx.BoxSizer(wx.HORIZONTAL)
+
+        self.penOptIcon  = ToolPaletteIcon(self.topPanel, id_PEN_OPT,
+                                           "penOpt", "Set Pen Colour")
+        self.fillOptIcon = ToolPaletteIcon(self.topPanel, id_FILL_OPT,
+                                           "fillOpt", "Set Fill Colour")
+        self.lineOptIcon = ToolPaletteIcon(self.topPanel, id_LINE_OPT,
+                                           "lineOpt", "Set Line Size")
+
+        margin = wx.LEFT | wx.RIGHT
+        optionSizer.Add(self.penOptIcon,  0, margin, 1)
+        optionSizer.Add(self.fillOptIcon, 0, margin, 1)
+        optionSizer.Add(self.lineOptIcon, 0, margin, 1)
+
+        margin = wx.TOP | wx.LEFT | wx.RIGHT | wx.ALIGN_CENTRE
+        self.toolPalette.Add(toolSizer,            0, margin, 5)
+        self.toolPalette.Add((0, 0),               0, margin, 5) # Spacer.
+        self.toolPalette.Add(self.optionIndicator, 0, margin, 5)
+        self.toolPalette.Add(optionSizer,          0, margin, 5)
+
+        # Make the tool palette icons respond when the user clicks on them.
+
+        self.selectIcon.Bind(wx.EVT_BUTTON, self.onToolIconClick)
+        self.lineIcon.Bind(wx.EVT_BUTTON, self.onToolIconClick)
+        self.rectIcon.Bind(wx.EVT_BUTTON, self.onToolIconClick)
+        self.ellipseIcon.Bind(wx.EVT_BUTTON, self.onToolIconClick)
+        self.textIcon.Bind(wx.EVT_BUTTON, self.onToolIconClick)
+        self.penOptIcon.Bind(wx.EVT_BUTTON, self.onPenOptionIconClick)
+        self.fillOptIcon.Bind(wx.EVT_BUTTON, self.onFillOptionIconClick)
+        self.lineOptIcon.Bind(wx.EVT_BUTTON, self.onLineOptionIconClick)
+
+        # Setup the main drawing area.
+
+        self.drawPanel = wx.ScrolledWindow(self.topPanel, -1,
+                                          style=wx.SUNKEN_BORDER)
+        self.drawPanel.SetBackgroundColour(wx.WHITE)
+
+        self.drawPanel.EnableScrolling(True, True)
+        self.drawPanel.SetScrollbars(20, 20, PAGE_WIDTH / 20, PAGE_HEIGHT / 20)