Search code examples
pythonpython-2.7gtkpygtk

gtk-error **: gtk_text_btree_previous_line ran out of lines aborting


Backstory: I am doing a irc bot with a gui. I have a textbuffer to show chat.(telling the textbuffer thing because I think it might be the problem)

The bot runs ok for a couple of seconds and then gives this error:

gtk-error **: gtk_text_btree_previous_line ran out of lines aborting...

My code is here. The main file is run.py.


Solution

  • Well im fumb I first tested this code:

    if chatbuffer.get_line_count() > 10:
        chatbuffer.delete(chatbuffer.get_iter_at_line(0), chatbuffer.get_iter_at_line(5))
    

    To know if it worked, bu then forgot to change the 10 to 500 on the final code, and it stayed like this:

    if chatbuffer.get_line_count() > 10:
        chatbuffer.delete(chatbuffer.get_iter_at_line(0), chatbuffer.get_iter_at_line(250))
    

    And that was the cause of the error, as soon as changed it to 500 it started working:

    if chatbuffer.get_line_count() > 500:
        chatbuffer.delete(chatbuffer.get_iter_at_line(0), chatbuffer.get_iter_at_line(250))