On Mon, 2002-07-22 at 09:04, Pier Carteri wrote:
> Hi again,
> Thanks Mr Reis for your answer, but this is not what I want to do; probably my 
>question was not so clear, 
> so I rewrite it in a more accurate way (at least I hope :-)
> 
> I'm writing a simple editor, and I want that when a user press a tab-key this char 
>is automatically replaced 
> with some spaces. I've tried to added a callback to the "insert-text" signal but 
>using this event I obtain a 
> buffer with some spaces after a tab  (instead of one with only spaces).
> Which signal should i use?

insert-text is what you want, but you need to use the 'length' parameter
that is passed to the handler. The signal handler signature looks like
this:

textwidget_insert_text(self, entry, text, len, obj):
        # entry is the text widget
        # text is a buffer of the newly inserted text
        # len is the number of characters in the buffer (it is not null
        #                                               terminated)
        # obj - I don't know what this object is or what it is used for.


> 
> Thank you
> 
> Pier Carteri
> 
> Christian Reis <[EMAIL PROTECTED]> wrote on 21/07/02 21.21.26:
> >
> >On Sun, Jul 21, 2002 at 07:13:50PM +0200, [EMAIL PROTECTED] wrote:
> >> 
> >> 
> >> Hi to all,
> >> i'm looking for the easiest way to automatically replace tab with spaces into a
> >> GtkTextBuffer. Has anyone already found the solution?
> >
> >string.replace("\t"," ",buffer.get_text()) ?
> >
> >Take care,
> >--
> >Christian Reis, Senior Engineer, Async Open Source, Brazil.
> >http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
> 
> 
> _______________________________________________
> pygtk mailing list   [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
Steve McClure                   430 10th St NW
Racemi                          Suite N-210
http://www.racemi.com           Atlanta, GA 30318
[EMAIL PROTECTED]             voice/fax: 404-892-5850

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to