Search code examples
pythonkivy

Meaning of "pop style stack without without push" in Kivy


What does it mean when Kivy gives this warning message? What can cause it?

[WARNING] [Label       ] pop style stack without push

Solution

  • I don't see any documentation about this message specifically, but here's the relevant bit from the source code that handles BBCode-style text markup:

    def _pop_style(self, k):
        if k not in self._style_stack or len(self._style_stack[k]) == 0:
            Logger.warning('Label: pop style stack without push')
            return
        v = self._style_stack[k].pop()
        self.options[k] = v
    

    The BBCode format lets you, for instance, make a word italic like [i]this[/i]. As the documentation puts it:

    A tag is defined as [tag], and should have a corresponding [/tag] closing tag.

    The wording of the error message is probably not the most user-friendly. It refers to the fact that the tags are handled internally as a stack; an opening tag is pushed onto the stack, and a closing tag is popped off of it. The error means you're trying to pop a style that's not already pushed onto the stack—in other words, you've closed a tag that's not already open.