Reputation: 876
I'm designing an editor in GTK+ and wanted to add a feature of the gedit text editor to represent the line number at the left side of the text. I've added an image of gedit showing the line number at the left of each line. I require guidance of which widget I should use and how to use it.
Thanks in advance :).. !
Upvotes: 2
Views: 1698
Reputation: 1336
In textview you can try this. self.textview.get_iter_at_location(x, y).get_line()
Documented here http://www.pygtk.org/pygtk2tutorial/sec-TextIters.html.
x, y position can be get using the following code:
x, y = self.textview.get_pointer()
x, y = self.textview.window_to_buffer_coords(gtk.TEXT_WINDOW_WIDGET, x, y)
Upvotes: 0
Reputation: 41045
It's an object called geditview, you can take a look to http://code.ohloh.net/file?fid=UbTA_LHqUuoYhNCUyaNFsy91ZqQ&cid=vmd9QnPTRes&s=&browser=Default#L545
geany also implements line-numbers using an object called Scintilla
Upvotes: 0