Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a small app that displays documentation. When it is run, the application window will display a main menu with buttons labeled 'Document 1', 'Document 2', etc.

If a user clicks on one of those buttons, the text from the corresponding document will be displayed in the window. Very basic. The text documents range in length from 1000 to 5000 words, and they need basic formatting (bold, italic, maybe one or two font choices).

My question is this: What is the best way to store and display long blocks of formatted text, using Quickly?

There seems to be a few options:

(1) I could load the text blocks into long python strings,

(2) I could load the text from text files, or

(3) I could somehow copy and paste the formatted text into Glade.

In the first two options, I'm not sure how I would format the text (add italic and bold, for instance) once it was loaded.

I have experience with PHP/MySQL/HTML/CSS/Javascript, but I'm new to Python. Any help would be appreciated.

share|improve this question
up vote 1 down vote accepted

The easiest way is actually what you're most familiar with: Just stick a browser on the screen and keep the text in HTML+CSS.

In practice this means using WebKit and that's actually very simple:

import gtk, webkit
# or perhaps you should use:
# from gi.repository import Gtk as gtk, WebKit as webkit

window = gtk.Window()
window.resize(1000, 600)

scroller = gtk.ScrolledWindow()

wk = webkit.WebView()

That's just a really simplistic way getting into it. The docs are pretty raw but they should give you an idea of what you can do.

The important thing is you don't waste any time formatting up billions of strings - you let webkit handle it.

share|improve this answer
@FlorianDiesch Yeah completely right - I was just pulling up an old example and was testing it it from a python console. Oddly, I'm having problems getting this to work with PyGObject so I've left the crufty old version in (it should still work in a Quickly project even if it is the old way of doing things) – Oli Sep 5 '12 at 15:38
Ah! I'm not sure why I didn't think of this--excellent answer. The machine on which this app will run won't always have internet access, but I can keep the HTML files locally. – Kevin Sep 7 '12 at 2:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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