0

I want to build an application which will have an input field where a user can type in a very small fragment of Python code.

Rather than use a dumb text-input field I'd like to use something that is aware of the Syntax of Python - possibly even supporting highlighting or indenting. Is there any way to get this kind of widget into my application?

I'm using Glade with Python 2.7 on Ubuntu.

1
  • 1
    I think you can use pygments for that ... May 17, 2013 at 20:38

1 Answer 1

0

Just try GtkSourceView. It is much like GtkTextView, with syntax highlight and code indentation. Both Gedit and Anjuta use it to edit code.

First you need to install libgtksourceview-3.0-dev so that you can use that widget(GtkSourceView) in Glade.

Then in your python script, import GtkSource:

from gi.repository import GtkSource

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.