Run PygTK cellrenderer edit from code

I have a treeview with an editable CellRendererText:

self.renderer = gtk.CellRendererText() self.renderer.set_property('editable', True) 

But now I need to run the version from the code instead of the user in order to focus the user on the fact that he just created a new line and should be named. I tried this but did not work:

 self.renderer.start_editing( gtk.gdk.Event(gtk.gdk.NOTHING), self.treeview, str(index), gtk.gdk.Rectangle(), gtk.gdk.Rectangle(), 0) 

There are no errors either, but the documentation of what each argument is is not clear, in fact I really don't know if the start_editing method is suitable for this.

All suggestions are welcome, thanks.

+4
source share
1 answer
 def set_cursor(path, focus_column=None, start_editing=False) 

... If the column is specified, and start_editing is True, then editing should begin in the specified cell. This method is often followed by the gtk.Widget.grab_focus() method to give the keyboard focus a tree structure.

A source

+6
source

Source: https://habr.com/ru/post/1305997/


All Articles