def enable_expanded_view(self):
        """Expand widget horizontally to provide space."""
        ### check the existence of a 'backups' attribute
        try:
            self.backups

        ### if it doesn't exist, it means the expanded
        ### view isn't enabled, so we do so

        except AttributeError:

            ### backup the current background, image and
            ### rect

            self.backups = [
                self.background,
                self.image,
                self.rect,
            ]

            ### create a new rect with the same height,
            ### as self.rect but the width of the screen
            ### (except we decrease the width a bit to
            ### provide a nice margin from the boundaries
            ### of the screen)

            new_rect = SCREEN_RECT.inflate(-40, 0)
            new_rect.height = self.rect.height

            ### center the new rect vertically on self.rect
            new_rect.centery = self.rect.centery

            ### assign the new rect to self.rect
            self.rect = new_rect

            ### create a new background and image for
            ### the respective attributes

            self.background = render_rect(*self.rect.size, self.background_color)

            self.image = self.background.copy()

            ### update the image and reposition the
            ### cursor

            self.update_image()
            self.cursor.reposition()

        ### otherwise, since it is enabled already we do
        ### nothing
        else:
            pass
Expand widget horizontally to provide space.
nodezator/widget/intfloatentry/modes.py