Returns a generator which yields the items added to the bar during
        construction, and updates the progress bar *after* the yielded block
        returns.

def generator(self):
        """
        Returns a generator which yields the items added to the bar during
        construction, and updates the progress bar *after* the yielded block
        returns.
        """
        if not self.entered:
            raise RuntimeError('You need to use progress bars in a with block.')

        if self.is_hidden:
            for rv in self.iter:
                yield rv
        else:
            for rv in self.iter:
                self.current_item = rv
                yield rv
                self.update(1)
            self.finish()
            self.render_progress()