Código PHP:
<?php
$window = new GtkWindow();
$window->set_size_request(400, 240);
$window->connect_simple('destroy', array('Gtk','main_quit'));
$window->add($vbox = new GtkVBox());
// display title
$title = new GtkLabel("Read a text file into GtkTextView");
$title->modify_font(new PangoFontDescription("Times New Roman Italic 10"));
$title->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#0000ff"));
$title->set_size_request(-1, 40);
$vbox->pack_start($title, 0, 0);
$vbox->pack_start(new GtkLabel(), 0, 0);
// Create a new buffer and a new view to show the buffer.
$texto = "en-2-2.txt";
$filename = @fopen($texto, 'r'); // note 1
$contents = file_get_contents($filename); // note 2
$buffer = new GtkTextBuffer(); // note 3
$buffer->set_text($contents); // note 4
$view = new GtkTextView(); // note 5
$view->set_buffer($buffer); // note 6
$view->set_wrap_mode(Gtk::WRAP_WORD);
$scrolled_win = new GtkScrolledWindow();
$scrolled_win->set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
$vbox->pack_start($scrolled_win);
$scrolled_win->add($view);
$window->show_all();
Gtk::main();
?>