Not signed in (Sign In)

Categories


 

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorselsine
    • CommentTimeFeb 13th 2007
     
    Post made by apurva

    hey,
    i really appreciate the efforts that you are making to make life simpler for absolute noobs like me
    i am trying to develop a spam filter and for demo purposes, simulating a mail viewer too(in glade+pygtk)

    Now, im getting stuck at a very trivial place.
    I display a particular mail in a TextView... but if i choose another mail, it is getting appended placed at the cursor position(since i use insert_at_cursor for the textbuffer), but actually, the previous mail should be cleared first, and then this 1 should be displayed.
    i set_overwrite(True) for the TextView object before printing, yet, the textview is not cleared.
    where am i going wrong??
    • CommentAuthorselsine
    • CommentTimeFeb 13th 2007
     
    Hi apurva,

    even if I think an independant thread would be better for your question here my answer:

    Why don't you just clear the whole Text-Buffer before writing the new mail in it?

    Response by supertux
    • CommentAuthorselsine
    • CommentTimeFeb 13th 2007 edited
     
    Sorry guys I'm not exactly sure how to move posts just yet, so I decided to do it this way just to get it done quickly.

    You should take a look at my second WordPy tutorial: WordPy 0.2 - Using XML to Save and Load Data

    In there I use a simple function to set all of the text in the gtk.TextView:


    def set_post_text(self, text):
    """Simple Helper function that sets the text
    in the text View.
    @param text - The text that will be put into
    the text view.
    """
    #select all of the text
    start, end = self.txtBuffer.get_bounds()
    self.txtBuffer.select_range(end,start)
    #insert over the selection i.e. replace all the text
    self.insert_text(text)
    #put the selection at the end.
    start, end = self.txtBuffer.get_bounds()
    self.txtBuffer.select_range(end,end)


    You should be able to use that function to either clear your gtk.TextView (set_post_text("")) or set it to your new email (set_post_text(email_text)).

    I hope this helps.

    selsine.
    • CommentAuthorexample010
    • CommentTimeJan 8th 2009 edited
     
    i used this method..

    textbuffer =gtk.TextBuffer(None)
    textbuffer.set_text("")
    • CommentAuthorselsine
    • CommentTimeFeb 28th 2009
     
    Ahh neat idea example010!
Add your comments
    Username Password
  • Format comments as