This method should be called every time through the main loop.

        It handles all of the keyboard key actions

        Parameters:
            | eventObj - the event object obtained by calling pygame.event.get()

        Returns:
            | False most of the time
            | True when the user clicks down and later up on the button.

def handleEvent(self, event):
        """This method should be called every time through the main loop.

        It handles all of the keyboard key actions

        Parameters:
            | eventObj - the event object obtained by calling pygame.event.get()

        Returns:
            | False most of the time
            | True when the user clicks down and later up on the button.

        """

        if not self.isEnabled:
            return False

        if (event.type == pygame.MOUSEBUTTONDOWN) and (event.button == 1): # user clicked
            theX, theY = event.pos
            # if self.imageRect.collidepoint(pos):
            if self.imageRect.collidepoint(theX, theY):
                if not self.focus:
                    self.focus = True   # give this field focus
                else:
                    # Field already has focus, must position the cursor where the user clicked
                    nPixelsFromLeft = theX - self.loc[0]
                    nChars = len(self.text)

                    lastCharOffset = self.font.size(self.text)[0]
                    if nPixelsFromLeft >= lastCharOffset:
                        self.cursorPosition = nChars
                    else:
                        for thisCharNum in range(0, nChars):
                            thisCharOffset = self.font.size(self.text[:thisCharNum])[0]
                            if thisCharOffset >= nPixelsFromLeft:
                                self.cursorPosition = thisCharNum  # Found the proper position for the cursor
                                break
                    self.cursorVisible = True # Show the cursor at the click point

            else:
                self.focus = False


        if not self.focus:  # if this field does not have focus, don't do anything
            return False

        keyIsDown = False  # assume False

        if event.type == pygame.KEYDOWN:
            keyIsDown = True
            self.currentKey = event.key  # remember for potential repeating key
            self.unicodeOfKey = event.unicode # remember for potential repeating key

        if event.type == pygame.USEREVENT:
            # This is a special signal to check for a repeating key
            # if the key is still down, repeat it
            keyPressedList = pygame.key.get_pressed()

            if (self.currentKey is not None) and (keyPressedList[self.currentKey]):  # Key is still down
                keyIsDown = True
            else:
                # Key is up
                pygame.time.set_timer(pygame.USEREVENT, 0)  # kill the timer
                return False


        if keyIsDown:
            if self.currentKey in (pygame.K_RETURN, pygame.K_KP_ENTER):
                # User is done typing, return True to signal that text is available (via a call to getValue)
                self.focus = False
                self.currentKey = None
                self._updateImage()

                if self.callBack is not None:
                    self.callBack(self.nickname)

                return True

            keyIsRepeatable = True  # assume it is repeatable unless specifically turned off
            if self.currentKey == pygame.K_DELETE:
                self.text = self.text[:self.cursorPosition] + \
                        self.text[self.cursorPosition + 1:]
                self._updateImage()

            elif self.currentKey == pygame.K_BACKSPACE:  # forward delete key
                self.text = self.text[:max(self.cursorPosition - 1, 0)] + \
                                    self.text[self.cursorPosition:]

                # Subtract one from cursor_pos, but do not go below zero:
                self.cursorPosition = max(self.cursorPosition - 1, 0)
                self._updateImage()

            elif self.currentKey == pygame.K_RIGHT:
                if self.cursorPosition < len(self.text):
                    self.cursorPosition = self.cursorPosition + 1

            elif self.currentKey == pygame.K_LEFT:
                if self.cursorPosition > 0:
                    self.cursorPosition = self.cursorPosition - 1

            elif self.currentKey == pygame.K_END:
                self.cursorPosition = len(self.text)
                keyIsRepeatable = False

            elif self.currentKey == pygame.K_HOME:
                self.cursorPosition = 0
                keyIsRepeatable = False

            elif self.currentKey in [pygame.K_UP, pygame.K_DOWN]:
                return False   # ignore up arrow and down arrow

            else:  # standard key
                # If no special key is pressed, add unicode of key to input_string
                self.text = self.text[:self.cursorPosition] + \
                                    self.unicodeOfKey + \
                                    self.text[self.cursorPosition:]
                self.cursorPosition = self.cursorPosition + len(self.unicodeOfKey)
                self._updateImage()

            if keyIsRepeatable:  # set up userevent to try to repeat key
                pygame.time.set_timer(pygame.USEREVENT, 200)  # wait for a short time before repeating

        return False