[pygtk] gtk.Entry and selection signal
Michal Pryc
Michal.Pryc at Sun.COM
Sun Mar 23 01:28:23 WST 2008
Michal Pryc wrote:
> Hello PyGTK community :)
>
> I am trying to enable/disable some menu items regarding if some text is
> selected/unselected (highlighted/un-highlighted) in the gtk.Entry
>
> Any ideas? I was trying with different "selection*" signals from
> gtk.Widget but no joy.
>
Ok I got it. Probably there is a better way, but here is what I found
(example):
def connect_functions(self):
self.gtk_entry.connect('event', self.gtk_entry_event)
def gtk_entry_event(self,widget,event):
if widget.get_selection_bounds():
'enable selection functions'
bounds = widget.get_selection_bounds()
print widget.get_chars(bounds[0],bounds[1])
else:
'disable selection function'
pass
--
best
Michal Pryc
More information about the pygtk
mailing list