

def update(self):
    '\n        Update the encapsulated pygame.Surface object to match the state of this PygcurseSurface object. This needs to be done before the pygame.Surface object is blitted to the screen if you want the most up-to-date state displayed.\n\n        There are three types of updating:\n            1) Updating the PygcurseSurface surface object to match the backend data.\n                (Enabled by default by setting self._autoupdate == True)\n            2) Blitting the PygcurseSurface surface object to the main window\n                (Enabled by setting self._windowsurface to the main window AND self._autoblit == True)\n            3) Calling pygame.display.update()\n                (Enabled by default if _windowsurface is set, self._autoblit == True, AND if _autodisplayupdate == True)\n        '
    for x in range(self._width):
        for y in range(self._height):
            if ((x > 0) and iswide(self._screenchar[(x - 1)][y])):
                self._screenchar[x][y] = None
                continue
            if self._screendirty[x][y]:
                self._screendirty[x][y] = False
                (cellfgcolor, cellbgcolor) = self.getdisplayedcolors(x, y)
                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
                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))
                self._surfaceobj.blit(charsurf, charrect)
    self._drawinputcursor()
    if ((self._windowsurface is not None) and self._autoblit):
        self._windowsurface.blit(self._surfaceobj, self._surfaceobj.get_rect())
        if self._autodisplayupdate:
            pygame.display.update()

dataset/ETHPy150Open asweigart/pygcurse/pygcurse/__init__.py PygcurseSurface.update/original