static-sites/bases/do-blog/resources/documents/python/gtk3/tutorial11.py

32 lines
1.3 KiB
Python
Executable File

#append this to module path so we can load from the parent directory
import sys, os
from scaffold import web
from scaffold.loaders import load, load_partial
class page:
name=__name__
title = 'GTK3 textview interaction'
tags = 'GTK3', 'Python', 'textview', 'interactive', 'cairo'
intro = 'Load a glade file displaying a textview widget which runs python code on carriage return.'
date = '2014-04-18'
path = os.path.abspath('./')
image = web.template.path_image + '/gtk/tut11-interactive-python-textview.png'
def create_content(self):
web.images.create(self.image, title='GTK Window')
web.page.section(
web.div.create(
web.images.render()
).set_classes('sources').render()
)
web.paragraph.create("""This example shows using the text view widget to get text entered by a use, it makes use of
marked text blocks so that only some text can be edited and will dynamically read the current line and run it in python interactively.
You can type app.test() or app.show_drawing(True) as examples of the interaction between the widget and python.""")
web.page.section(web.paragraph.render())
web.pre.create(load(os.path.abspath('./content/gtk3/tut11/tut11-interactive-python-textview.py')))
web.page.section(web.pre.render())