Next / Previous / Contents / Shipman's homepage

5.11. ScrolledList.insert(): Insert a line of text

This method inserts a line of text before the line at the specified position. If the position is out of range, we'll just place it at the end.
    def insert(self, linex, text):
        """Insert a line between two existing lines.

        #-- 1
        if  0 <= linex < self.count():
            where = linex
            where = tk.END

        #-- 2
        self.listbox.insert(where, text)