Re: [pygtk] _another_ question - gtk.Layout and new_gc
On Fri, Oct 10, 2003 at 08:08:00PM +0100, Rob Scott wrote: > From what I understand, a gtk.Layout does not have a > gtk.gdk.Window, or at least not one with a new_gc > method. > > So, it is not possible to draw to a gtk.Layout, > because it has no drawable. > > Am I right? Yes, you are. But the Layout will draw upon its parent window (or its closest ancestor with a window), so I presume you could draw on that. You may also be able to pack it inside a GtkEventBox, which *does* have a window, and draw on that. Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331 ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] misc widgets with a treeview?
On Sat, Oct 11, 2003 at 03:14:40PM +1300, Thomi Richards wrote: > I'd like to display a combo box in a cell within a treeview. I'm fairly sure > I've seen other gtk ap[ps doing this, so I'm hoping it's possible... It's possible. Search the list archives for an example contributed (by lgs, IIRC). It's not entirely trivial (you need to write a custom renderer, IIRC) and there may be some snags, but if you manage to cook one up, please let me know so I can add it to the FAQ. Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331 ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] How to stop a key_press_event in a TextView to prevent to write a space?
A Sáb, 2003-10-11 às 17:42, Dàvik escreveu: > 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. Return True when you want to stop the event from being handled by the widget. By default, it returns None, which is False, which is an indication that the event was not handled. > > 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 pressedprint '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 > characteriter.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/ -- Gustavo J. A. M. Carneiro <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] How to stop a key_press_event in a TextView to prevent to write a space?
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 pressedprint '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 characteriter.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/
Re: [pygtk] Get characters in a TextView
Hi, for have an iter at the current cursor position you can do: iter=buffer.get_iter_at_mark(buffer.get_insert()) at this point you use iter.get_char() for obtain the current char, then move the iter with iter.backward_char() and again iter.get_char() for check the previous char Best Regards! Pier Il sab, 2003-10-11 alle 06:37, Dàvik ha scritto: > Hi! > > I'd like to know what are the 2 characters around the cursor in a > TextView in a given moment. How should I do it? > > I found TextIter.get_char(), but it only gets the next character, not > the previous. Besides, I don't know how to create a TextIter of the > current offset of the cursor. > > Why all this? I want a TextView where no 2 spaces can be written one > after the other, just like in lyx. > -- Pier Carteri <[EMAIL PROTECTED]> ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/