Re: [gedit-list] Need help in accessing the text from gedit text editor programmatically
- From: Peter Bittner <peter bittner gmx net>
- To: Kantha Girish <kanthagirish gmail com>, gedit-list gnome org
- Subject: Re: [gedit-list] Need help in accessing the text from gedit text editor programmatically
- Date: Fri, 17 Apr 2015 22:29:53 +0200
Hi Kantha,
not sure whether that can help you much, but I have a gedit plugin
that accesses the text of the current editor window (and converts it
to HTML for displaying it in the bottom panel).
https://github.com/bittner/gedit-reST-plugin/blob/gedit-3.14/reST/restructuredtext.py#L58
It's kind of like:
view = parent_window.get_active_view()
doc = view.get_buffer()
text = doc.get_text()
See the implementation on GitHub for details.
Hope that helps,
Peter
2015-04-17 20:21 GMT+02:00 Sébastien Wilmet <swilmet gnome org>:
Hi Kantha,
On Fri, Apr 17, 2015 at 05:52:04PM +0530, Kantha Girish wrote:
I am trying to develop a plugin for gedit in python. Since the
documentation is not so informative in terms of python, I need some help on
how to access the text which is being typed in the active editor. A small
example would be good as I couldn't even figure out the number of
parameters and what type of parameters are being used by a particular
method under a particular object.
You should read some documentation on how to write Python programs while
using GObject-based libraries. I don't know much about Python, so I
can't really help you on that.
gedit is based on GtkTextView and GtkSourceView, see:
https://wiki.gnome.org/Projects/GtkSourceView
http://www.bravegnu.org/gtktext/
And for the plugin system, libpeas is used.
Hope that helps,
Sébastien
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]