Hi!
I have the next function in a TextView. I'd like the TextView not to
write another space when there's another space around the cursor. The
problem is that I don't know how to break the key_press_event.
If it was possible to change the value of event.keyval to None or ''...
Thank you in advance!
D�vik
def key_pressed(self, widget, event):
if event.keyval == gtk.gdk.keyval_from_name('space'): #If a
space has been pressed print 'space pressed'
buffer = self.textview.get_buffer()
iter = buffer.get_iter_at_mark (buffer.get_insert())
next_char = iter.get_char() #Look the value of the next
character iter.backward_char() #Move backwards in the iter
previous_char = iter.get_char() #Look the value of the
previous character
if next_char == ' ' or previous_char == ' ': # If the value
of one of both is a character... what should I do? what
should I do? else:
print 'no space pressed'
print event.keyval
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/