def update(self):

        # TODO - None of this code is optimized yet.

        # "Dirty" means that the cell's state has been altered on the backend and it needs to be redrawn on pygame.Surface object (which will make the cell "clean").
        for x in range(self._width):
            for y in range(self._height):
                # Skip if previous char was a CJK wide char
                if x > 0 and iswide(self._screenchar[x-1][y]):
                    # Set this unprinted char to a dummy value. Otherwise, it will screw up following chars (thanks to this same check) if it happened to have the value of a wide char.
                    self._screenchar[x][y] = None
                    continue

                if self._screendirty[x][y]: # draw to surfaceobj all the dirty cells.
                    self._screendirty[x][y] = False

                    # modify the fg and bg color if there is a tint
                    cellfgcolor, cellbgcolor = self.getdisplayedcolors(x, y)

                    # fill in the entire background of the cell
                    cellrect = pygame.Rect(self._cellwidth * x, self._cellheight * y, self._cellwidth, self._cellheight)

                    if self._screenchar[x][y] is None:
                        self._surfaceobj.fill(ERASECOLOR, cellrect)
                        continue

                    self._surfaceobj.fill(cellbgcolor, cellrect)

                    if self._screenchar[x][y] == ' ':
                        continue # don't need to render anything if it is just a space character.

                    # render the character and draw it to the surface
                    charsurf = self._font.render(self._screenchar[x][y], 1, cellfgcolor, cellbgcolor)
                    charrect = charsurf.get_rect()
                    charrect.centerx = self._cellwidth * x + int(self._cellwidth*getcharwidth(self._screenchar[x][y]) / 2)
                    charrect.bottom = self._cellheight * (y + 1) # TODO - not correct, this would put stuff like g, p, q higher than normal.
                    self._surfaceobj.blit(charsurf, charrect)

        self._drawinputcursor()

        # automatically blit to "window surface" pygame.Surface object if it was set.
        if self._windowsurface is not None and self._autoblit:
            self._windowsurface.blit(self._surfaceobj, self._surfaceobj.get_rect())
            if self._autodisplayupdate:
                pygame.display.update()
return an iteration of tuples of category and list of all words in instances of that category.
dataset/ETHPy150Open asweigart/pygcurse/pygcurse/__init__.py/PygcurseSurface.update--crossover with--dataset/ETHPy150Open japerk/nltk-trainer/train_classifier.py/category_words