Instant Access to Rapid GUI Programming with Python and Qt 1st Edition Mark Summerfield ebook Full Chapters
Instant Access to Rapid GUI Programming with Python and Qt 1st Edition Mark Summerfield ebook Full Chapters
Instant Access to Rapid GUI Programming with Python and Qt 1st Edition Mark Summerfield ebook Full Chapters
com
https://ebookname.com/product/rapid-gui-programming-with-
python-and-qt-1st-edition-mark-summerfield/
OR CLICK BUTTON
DOWNLOAD EBOOK
https://ebookname.com/product/gui-programming-with-python-qt-edition-
boudewijn-rempt/
ebookname.com
https://ebookname.com/product/programming-in-python-3-a-complete-
introduction-to-the-python-language-2nd-edition-summerfield/
ebookname.com
https://ebookname.com/product/programming-python-4th-edition-mark-
lutz/
ebookname.com
https://ebookname.com/product/learning-and-teaching-in-the-chinese-
classroom-responding-to-individual-needs-1st-edition-shane-n-
phillipson/
ebookname.com
The Critique of Instrumental Reason from Weber to Habermas
1st Edition Darrow Schecter
https://ebookname.com/product/the-critique-of-instrumental-reason-
from-weber-to-habermas-1st-edition-darrow-schecter/
ebookname.com
https://ebookname.com/product/practical-obstetrics-and-gynecology-2nd-
edition-richa-saxena/
ebookname.com
https://ebookname.com/product/water-encyclopedia-domestic-municipal-
and-industrial-water-supply-and-waste-disposal-1st-edition-jay-h-lehr/
ebookname.com
https://ebookname.com/product/discrete-mechanics-1st-edition-jean-
paul-caltagirone/
ebookname.com
https://ebookname.com/product/imperial-ascent-mountaineering-
masculinity-and-empire-first-edition-peter-l-bayers/
ebookname.com
100 Q A About Alcoholism Drug Addiction 1st Edition
Charles Herrick
https://ebookname.com/product/100-q-a-about-alcoholism-drug-
addiction-1st-edition-charles-herrick/
ebookname.com
Rapid GUI Programming
with Python and Qt
The Definitive Guide to PyQt Programming
Mark Summerfield
Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
vii
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
viii
Creating and Using Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Restoring and Saving the Main Window’s State . . . . . . . . . . . . . . 181
Handling User Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Handling File Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Handling Edit Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Handling Help Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
ix
Multiple Document Interface (MDI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Chapter 10. Events, the Clipboard, and Drag and Drop . . . . . . . . . 303
The Event-Handling Mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Reimplementing Event Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Using the Clipboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
Drag and Drop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
Handling Custom Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
x
Chapter 14. Model/View Programming . . . . . . . . . . . . . . . . . . . . . . . . . . 413
Using the Convenience Item Widgets . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Creating Custom Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
Implementing the View Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
Implementing the Custom Model . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Creating Custom Delegates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
xi
Chapter 19. Multithreading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537
Creating a Threaded Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
Creating and Managing Secondary Threads . . . . . . . . . . . . . . . . . . . . . 544
Implementing a Secondary Thread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558
This Is Not Quite the End . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
xii
Foreword
As PyQt’s creator, I’m delighted to see that this book has been written. Al-
though I served as one of the book’s technical reviewers, I’m happy to confess
that I learned a few things myself.
The PyQt documentation covers the APIs of all the PyQt classes. This book
shows you how to use all those classes, how to combine them to create dialogs,
main windows, and entire applications—all of which look good and work well,
with no arbitrary limits, and using a programming language that is a joy
to use.
What I particularly like about the book is that the examples aren’t trivial ones
designed to illustrate a simple point, but are potentially useful in their own
right. The way that different approaches are considered will reward the reader
who wants to develop a deeper understanding of how to apply PyQt to the
development of large scale, production quality applications.
I began the PyQt story back in the late 1990s. I had been using Tcl/Tk for
some time, but I felt that Tk applications looked ugly, especially when I saw
what had been achieved with the first version of KDE. I had wanted to switch
to Python, and so I thought I would combine the change of language with a
change of GUI library.
Initially I used some wrappers that had been written using SWIG, but I con-
cluded that I could produce a more suitable wrapper tool myself. I set to work
creating SIP, and released PyQt 0.1 supporting Qt 1.41 in November 1998.
Development has continued regularly ever since, both to keep up with new re-
leases of Qt and to broaden the scope of PyQt with, for example, the addition
of support tools and improved documentation. By 2000, PyQt 2.0 supported
Qt 2.2 on both Linux and Windows. Qt 3 support appeared in 2001, and
Mac OS X support in 2002. The PyQt4 series began with PyQt 4.0 in June 2006
with support for Qt 4.
My primary goal has always been to allow Python and Qt to work together in
a way that feels natural to Python programmers, while allowing them to do
anything they want in Python that can be done in C++. The key to achieving
this was the development of SIP. This gave me a specialized code generator
over which I had complete control and ensures that Python and Qt will always
fit snugly together.
The essential process of developing and maintaining PyQt is now well estab-
lished. Much of the work is now automated, which means that keeping up with
xiii
new releases of Qt from Trolltech is no longer the problem it once was, and en-
surs that PyQt will continue for years to come.
It’s been very gratifying to watch the growth of the PyQt community over the
years. If this book is part of your introduction to PyQt, then welcome!
— Phil Thompson
Wimborne, Dorset, U.K.
August 25, 2007
xiv
Introduction
This book teaches how to write GUI applications using the Python program-
ming language and the Qt application development framework. The only
essential prior knowledge is that you can program in some object-oriented pro-
gramming language, such as C++, C#, Java, or of course, Python itself. For the
rich text chapter, some familiarity with HTML and with regular expressions is
assumed, and the databases and threading chapters assume some basic knowl-
edge of those topics. A knowledge of GUI programming is not required, since
all the key concepts are covered.
The book will be useful to people who program professionally as part of their
job, whether as full-time software developers, or those from other disciplines,
including scientists and engineers, who need to do some programming in sup-
port of their work. It is also suitable for undergraduate and post-graduate stu-
dents, particularly those doing courses or research that includes a substantial
computing element. The exercises (with solutions) are provided especially to
help students.
Python is probably the easiest to learn and nicest scripting language in
widespread use, and Qt is probably the best library for developing GUI applica-
tions. The combination of Python and Qt, “PyQt”, makes it possible to develop
applications on any supported platform and run them unchanged on all the
supported platforms—for example, all modern versions of Windows, Linux,
Mac OS X, and most Unix-based systems. No compilation is required thanks
to Python being interpreted, and no source code changes to adapt to different
operating systems are required thanks to Qt abstracting away the platform-
specific details. We only have to copy the source file or files to a target machine
that has both Python and PyQt installed and the application will run.
If you are new to Python: Welcome! You are about to discover a language that
is clear to read and write, and that is concise without being cryptic. Python
supports many programming paradigms, but because our focus is on GUI
programming, we will take an object-oriented approach everywhere except in
the very early chapters.
Python is a very expressive language, which means that we can usually write
far fewer lines of Python code than would be required for an equivalent appli-
cation written in, say, C++ or Java. This makes it possible to show some small
but complete examples throughout the text, and makes PyQt an ideal tool for
rapidly and easily developing GUI applications, whether for prototyping or for
production use.
1
2 Introduction
programming teams varying in size from just one person to more than a dozen
people. Many in-house tools are written using PyQt, but because these are of-
ten used to gain competitive advantage, the companies involved generally do
not permit their use of PyQt to be made public. PyQt is also widely used in the
open source world, with games, utilities, visualization tools, and IDEs all writ-
ten using it.
This book is specifically about PyQt4, the Python bindings for the Qt 4 C++
application development framework.★ PyQt4 is provided in the form of ten
Python modules which between them contain around 400 classes and about
6 000 methods and functions. All the example programs have been tested on
Windows, Linux, and Mac OS X, using Python 2.5, Qt 4.2, and PyQt 4.2, and
additionally on Windows and Linux using Qt 4.3 and PyQt 4.3. Backporting to
earlier versions is possible in some cases, but we recommend using the most
up-to-date versions of Python, Qt, and PyQt.
Python, PyQt, and Qt can be used free of charge for noncommercial purposes,
but the license used by Python is different from that used by PyQt and Qt.
Python is available with a very liberal license that allows it to be used to de-
velop both commercial and noncommercial applications. Both PyQt and Qt are
dual-licensed: This essentially allows them to be used to develop noncommer-
cial applications—which must in turn be licensed using an acceptable open
source license such as the GNU General Public License (GPL); or to be used to
develop commercial applications—in this case, a commercial PyQt license and
a commercial Qt license must be purchased.
The book is divided into four parts. Part I is primarily a rapid conversion course
aimed at non-Python programmers who are familiar with an object-oriented
language, although it also has some (clearly marked) PyQt content. Because
the core Python language is mostly simple and is quite small, these chapters
can teach the basics of Python to a sufficient extent that real Python applica-
tions can be written.
If you think that you can pick up the Python syntax simply through reading
it, you might be tempted to skip Part I and dive straight into the GUI pro-
gramming that begins in Part II. The early chapters in Part II include back-
references to the relevant pages in Part I to support readers who choose this
approach. However, even for readers familiar with Python, we recommend
reading about QString in Chapter 1. If you are unfamiliar with partial function
application (currying), it is important to read the subsection that covers this in
Chapter 2, since this technique is sometimes used in GUI programming.
★
There are also Python bindings for the older Qt 3 library, but there is no reason to use that library
for new projects, especially since Qt 4 offers far more functionality and is easier to use.
4 Introduction
Part II begins by showing three tiny PyQt GUI applications to give an initial
impression of what PyQt programming is like. It also explains some of the
fundamental concepts involved in GUI programming, including PyQt’s high-
level signals and slots communication mechanism. Chapter 5 shows how to
create dialogs and how to create and lay out widgets (“controls” in Windows-
speak—the graphical elements that make up a user interface such as buttons,
listboxes, and such) in a dialog. Dialogs are central to GUI programming: Most
GUI applications have a single main window, and dozens or scores of dialogs,
so this topic is covered in depth.
After the dialogs chapter comes Chapter 6, which covers main windows,
including menus, toolbars, dock windows, and keyboard shortcuts, as well as
loading and saving application settings. Part II’s final chapters show how to
create dialogs using Qt Designer, Qt’s visual design tool, and how to save data
in binary, text, and XML formats.
Part III gives deeper coverage of some of the topics covered in Part II, and in-
troduces many new topics. Chapter 9 shows how to lay out widgets in quite
sophisticated ways, and how to handle multiple documents. Chapter 10 covers
low-level event handlers, and how to use the clipboard as well as drag and drop,
text, HTML, and binary data. Chapter 11 shows how to modify and subclass
existing widgets, and how to create entirely new widgets from scratch, with
complete control over their appearance and behavior. This chapter also shows
how to do basic graphics. Chapter 12 shows how to use Qt 4.2’s new graphics
view architecture, which is particularly suited to handling large numbers of in-
dependent graphical objects. Qt’s HTML-capable rich text engine is covered in
Chapter 13. This chapter also covers printing both to paper and to PDF files.
Part III concludes with two chapters on model/view programming: Chapter 14
introduces the subject and shows how to use Qt’s built-in views and how to
create custom data models and custom delegates, and Chapter 15 shows how
to use the model/view architecture to perform database programming.
Part IV continues the model/view theme, with coverage of three different
advanced model/view topics in Chapter 16. The first section of Chapter 17
describes the techniques that can be used for providing online help, and the
second section explains how to internationalize an application, including how
to use Qt’s translation tools to create translation files. The Python standard
library provides its own classes for networking and for threading, but in the
last two chapters of Part IV we show how to do networking and threading us-
ing PyQt’s classes.
Appendix A explains where Python, PyQt, and Qt can be obtained, and how to
install them on Windows, Mac OS X, and Linux. PyQt is much easier to learn
if you install it and try out some of the exercises, and if you inspect some of
the example code. Appendix B presents screenshots and brief descriptions
of selected PyQt widgets; this is helpful for those new to GUI programming.
Appendix C presents diagrams of some of PyQt’s key class hierarchies; this
Introduction 5
is useful for getting to know what classes PyQt has to offer and how they
are related.
If you have never used Python before, you should begin by reading Chapters
1–6 in order. If you already know Python, at least read the string policy (in
bullet points on page 28), and skim the material in Chapter 2 (apart from the
first section, which you’ll know well). Make sure that you are comfortable with
lambda and partial function application, both of which are covered in Chapter 2.
It is probably also worth skimming Chapter 3 as well. Then read Chapters 4,
5, and 6 in order.
Once you have covered the first six chapters, you have covered the essentials
of Python and the fundamentals of PyQt.
Chapter 7 is useful if you want to know how to create dialogs using a visual
design tool rather than purely by hand coding, something that can save a lot
of time. For file handling, at least read the first three sections of Chapter 8. If
you plan to write and read text files, also read Chapter 8’s fourth section, and
similarly the fifth section if you are going to use XML files.
For Part III, at the least read Chapter 10’s first section, on event handling, and
all of Chapter 11. Chapter 12 and the first section of Chapter 13 assume that
you have read about PyQt’s event handling, and that you have read Chapter 11.
Chapters 9 and 14 can be read stand-alone in this part, but Chapter 15 assumes
that you have read Chapter 14.
In Part IV, Chapter 16 assumes that you have read Chapters 14 and 15, but the
other chapters can be read independently.
If you find errors in the text or in the examples, or have other comments,
please write to [email protected] quoting “PyQt book” in the subject line. The
book’s home page, where any corrections will be published, and from where the
examples and exercise solutions can be downloaded, is http://www.qtrac.eu/
pyqtbook.html.
If you want to participate in the PyQt community, it is worthwhile joining the
mailing list. Go to http://www.riverbankcomputing.com/mailman/listinfo/pyqt to
find a link to the archive, so that you can see what the mailing list is like, and
also for a form for joining. Python also has mailing lists and other community
activities. For these, go to http://www.python.org/community.
Acknowledgments
I have many people to thank, and I will begin with those who have been
intimately involved with the book.
Jasmin Blanchette is a senior software developer at Trolltech, a Qt expert, and
a fine editor and writer in his own right. I have cowritten two C++/Qt books
with him. Jasmin has made a huge number of suggestions and criticisms that
have immensely improved the quality of this book.
6 Introduction
Python Programming
This page intentionally left blank
1
● Executing Python Code
● Variables and Objects
● Numbers and Strings
● Collections
● Built-in Functions
If you have not already installed Python and PyQt, it would be a good idea to
do so: That way you will be able to try out the examples that accompany this
book (downloadable from http://www.qtrac.eu/pyqtbook.html). See Appendix A
for installation details. One advantage of installing the software is that the
IDLE integrated development environment is installed along with Python.
9
10 Chapter 1. Data Types and Data Structures
Introduction
★
The programs in this book are written using ASCII characters, with escape sequences where Uni-
code is required. It is possible to use Latin-1, UTF-8, or other encodings for strings and comments
in Python programs, as explained in the documentation under “Encoding declarations”.
Executing Python Code 11
Assuming that we have saved the code in the file hello.py (in the directory
C:\pyqt\chap01 if using Windows), we can start up a console (click Start→All Pro-
grams→Accessories→Console on Windows XP—sometimes Console is called Com-
mand Prompt; or run Terminal.app from /Applications/Utilities on Mac OS X),
change to that directory, and execute the program like this:
C:\>cd c:\pyqt\chap01
C:\pyqt\chap01>hello.py
As long as Python is correctly installed, Windows will recognize the .py file
extension and give the file to python.exe to execute. The program will print
“Hello World” on the console as we would expect.★
On Mac OS X and Linux we must explicitly run the interpreter by typing its
name and the file’s name at the console’s prompt, like this:
% python hello.py
This will work providing that Python is installed and in your PATH. Alternative-
ly, for Linux and Mac OS X, we can add an additional “shebang” (shell execute)
comment line which tells the operating system to use a Python interpreter,
making the hello.py file two lines long:
#!/usr/bin/env python
print "Hello World"
For this to work on Mac OS X and Linux, the file’s permissions must be set
correctly. For example, at the console prompt in the same directory as the file,
enter chmod +x hello.py to make the file executable.
Python comments start with “#” and continue until the end of the line. This
means that it is perfectly safe to add the “shebang” line to all Python programs,
since the comment is ignored on Windows but on Linux it tells the operating
system to execute the file using a Python interpreter. Appendix A shows how
to associate the Python interpreter with .py and .pyw files on Mac OS X.
When we speak of executing a Python program, what happens behind the
scenes is that Python reads the .py (or .pyw) file into memory, and parses it, to
get a bytecode program that it then goes on to execute. For each module that is
imported by the program, Python first checks to see whether there is a precom-
piled bytecode version (in a .pyo or .pyc file) that has a timestamp which corre-
sponds to its .py file. If there is, Python uses the bytecode version; otherwise, it
parses the module’s .py file, saves it into a .pyc file, and uses the bytecode it just
generated. So, unlike Java, we don’t have to explicitly bytecode-compile any
modules, whether they are supplied with Python or are ones we have written
ourselves. And in most Python installations, the supplied modules are com-
★
Mac OS X users note that whenever we refer to a console, this is the same as a Mac Terminal.
12 Chapter 1. Data Types and Data Structures
>>> x = 71
>>> y = "Dove"
>>> x = 82
>>> x += 7
>>> x
89
Later on we will see cases where the fact that Python variables are object Lists
references makes a difference. ☞ 31
★
This is similar to the Java assignment, Integer x = new Integer(71); for C++ a near-equivalent
would be int xd = 71; int &x = xd;.
Random documents with unrelated
content Scribd suggests to you:
Abner truly told me I was beginning at the wrong end when I first
spoke to him long ago. I did not understand him then, but I begin to
do so now. I may never see things clearly, as you do, in the heavenly
light; but at least I do see that our first aim and object must be to do
God’s work on earth in His way; not blinded by our own wishes and
ambitions. The fate of poor Saul Tresithny will always be a warning
and a landmark to me. He might have grown as wild and reckless
without my teaching—with that I have nothing to do—but I did teach
him dangerous doctrines of all sorts, and his life and death are a
standing memorial to me of what such teaching may lead to. I trust
the lesson has not been learned in vain.”
“And I think his death was a very happy one,” said Bride softly. “I
think I am glad he died with us alone. He loved you, Eustace. And I
am sure if any of us had our choice, we should always choose to be
with the being we love best at the moment of our death. It was so
with him. I think it was rather beautiful and wonderful how he rose
and came to you when the hand of death was upon him. Poor Saul!
—but we need not grieve for him. Abner has ceased to grieve, and is
more peaceful and happy than I have seen him for many years. ‘To
depart and be with Christ’ was so much better for him than anything
he had to expect upon earth. He learned his lesson at the last—I am
sure his end was peace.”
After that there was no reserve on any subject between Eustace and
his betrothed wife. Bride was able to speak to him from the very
depths of her heart, and as she elevated and strengthened his
spiritual perceptions, so did he in another fashion impart to her such
knowledge of the things of this world as were beneficial to her in
forming her mind and character, and helping her to obtain a just and
accurate outlook upon the affairs of the nation and the events
moving the hearts of men. They acted as a check one upon the
other; helping, strengthening, teaching, and encouraging—growing
every day nearer in love and in spirit, finding fresh happiness and
closer unity of soul each day as it passed, and always upheld by the
thought that a few days more would see their union hallowed and
blessed in the sight of God—a thought so unspeakably sweet and
precious to both that they seldom spoke of it, though it was never
altogether out of their thoughts.
Mr. St. Aubyn was to perform the ceremony, with the cordial consent
of Mr. Tremodart, who was glad to be spared the task himself. The
Rector of St. Erme had been much at the castle when Eustace lay in
so critical a state, and the young man had profited much from his
instruction and counsel. Now he came frequently to see both Bride
and her betrothed husband, for he was one of those who rejoice to
see true spirituality in all its forms, and to be certain before hearing
pronounced any solemn and binding vows that they are spoken from
the very heart.
The Duke went about looking very happy in those days, and his
manner to his daughter was more gentle and fatherly than it had
ever been before. The whole castle was in a subdued state of
excitement, whilst a lawyer from London arrived, who was to remain
till the completion of the ceremony and see to all the needful papers.
But with these things Bride felt little concern, and went about with a
tranquil face, thankful to be spared the bustle of preparation which
would have been needful under ordinary circumstances, but which
was quite superfluous now.
A bridal dress and veil were, however, quickly provided, and Bride
was content that it should be so, knowing that her white would be
pleasing to the eye of the sick man. She herself was calmly and
tranquilly happy, spending much time beside the patient, and the rest
in earnest musings and meditation, or in visits to the poor, amongst
whom so much of her life had been passed.
It was a clear, sunny morning toward the end of January when Bride
awoke with the consciousness that it was her wedding-day—though
so quiet and uneventful a wedding as was to be hers perhaps no
Duke’s daughter had yet known. Even her name would not be
changed, as Eustace had playfully told her, nor would she leave the
shelter of her father’s roof. All the change that would take place
would be that she and her husband would take up their quarters in a
suite of rooms specially prepared for them, with Bride’s nurse and
Eustace’s man for their especial attendants. But the young wife
would continue to take her place at her father’s table when he took
his meals, waiting upon her husband and sharing his at different
hours, such hours as were prescribed by his medical man. Although
all this sounded strange to outsiders, who heard with amaze that
Lady Bride was going to marry her father’s heir while he was still
crippled and helpless, it did not seem strange to her. Others said it
was an obvious marriage of convenience and diplomacy, but never
had been a marriage of purer and truer affection. Bride robed herself
with a happy heart and a serene face, and was not surprised to
receive a message at the last that Abner would much like a few
words with his young mistress, if she could spare them for him.
He was in the great conservatory when she went down—the place
where so many talks had taken place between them, and where
Bride pictured Eustace lying in comfort and pleasure before very
long, surrounded by sweet scents and beautiful blossoms. Abner
held in his hand a beautiful bouquet of white flowers, and Bride
thanked him with one of her sweetest smiles as she took it from his
hands.
“I did want to see yu my own self, my Ladybird,” he said in a voice
that shook a little, “to wish yu every joy and a blessing on your new
life. I know there will be a blessing on it, for there’s One above as
has yu very near His heart; but yu’ll let an old man as has loved yu
ever since yu were a babe in the nurse’s arms give yu his blessing
to-day.”
Bride held out her slim white hand, which the old man took and
carried very tenderly to his lips; and her voice shook a little as she
said, “Thank you for that blessing, Abner. I feel my heart the warmer
for it. We know that this world’s happiness is but a small thing
compared to the glory that is to be revealed; but yet we must be
thankful when it does come to us, and take it as God’s best gift. I
think that your heart is at peace now, and that your worst trouble is
laid at rest.”
“Bless the Lord—it is so indeed. My boy died with His name on his
lips. I couldn’t ask more for myself.”
Bride could not linger. Mr. St. Aubyn had already arrived and wished
to speak with her alone. She found him pacing the room with slow
and thoughtful mien, but his eyes were very bright and glad.
“My child,” he said softly, “I wished to speak with you a few moments
before we go upstairs. I have just been seeing him you are to wed.
My dear, I think I need not say all that I feel about the change I find in
him since first I knew him. I can pronounce the benediction of holy
matrimony over you two with a glad and thankful heart. In the sight of
man and of God such a union as yours must be holy indeed.”
Bride’s eyes were softly bright.
“I know we love one another,” she said softly, “but I think that the
love of God comes first—indeed, I trust it is so.”
“I believe so truly,” he answered; “and, my child, I have been talking
to-day to Eustace. He has long been hindered by sickness from the
ordinances of the Church—the most blessed ordinance instituted by
our Lord for His faithful people to follow until His coming again.
Before that, as you know, he was something slack and doubtful, and
did not avail himself of the Christian privileges in their fullest
measure; and it is long since he has partaken of the bread and wine
blessed in the name of the Lord. And he wishes now that he may
receive this Holy Communion with you—his newly wedded wife—so
soon as you are made one. I indeed have thankfully and joyfully
assented to this, and even now the room is being prepared for the
simple ceremony which shall make you his, and then you can
together partake of that Body and Blood—the sign and symbol of the
Ineffable Love. I am sure, my child, that your heart will rejoice, as
mine does, over this return of the lost sheep to the fold. We have
known for long that that son has been turning homewards, and that
the Father has gone forth to meet him. Now we shall see him at the
Father’s table, partaking of the mystical feast which it is our Christian
privilege to enjoy. ‘Do this in remembrance of Me.’ It will, I know, be a
joyous thing for you that the following of this gracious and simple
command shall be the first act of your married life.”
Tears were standing in Bride’s soft eyes. She put out her hand and
laid it on Mr. St. Aubyn’s arm.
“I am too happy to talk about it,” she said; “it is the one thing to make
the day complete; but oh! Mr. St. Aubyn, I have so often wanted to
thank you for what you said to me that day long ago about the lost
son and the returning home. It was such a help. It was that which
made me begin to pray in hope for Eustace, instead of naming him
only in a sort of faithless despondency. I was in danger of being like
the elder brother, and looking upon him and many others as
altogether beyond the pale of the Father’s love. After that I could
always pray in hope; and I think—I believe, that my prayers did help
him. You know what you said about that being God’s way of leading
to Him some one who would not yet pray for himself.”
The clergyman smiled tenderly upon the girl.
“God bless you, my child,” he said softly. “I think you will be your
mother over again as the years go by. Such faith as hers I have
never seen in any one else, but I think I shall live to see it in you.”
“I have received so much,” answered Bride softly, “I should not be
able to doubt even if I wished.”
Only a few minutes later, and Bride entered the room where Eustace
lay, leaning on her father’s arm, her face shaded by her veil, but not
so concealed that its serene beauty and composure could not be
seen. Some dozen of the old servants of the castle, and two or three
old friends, were present to witness the simple ceremony; but Bride
only saw Eustace; and none who caught the glance that flashed from
one to the other ever forgot it. The room was decked with flowers,
everything was perfectly simple, yet perfectly appropriate, and Mr.
St. Aubyn’s rendering of the holy words was doubly impressive from
the peculiar circumstances of the case. Bride’s vows were spoken
with a steady sweetness which brought tears to many eyes; all the
faltering was on Eustace’s part, and was made through the depth of
his emotion. It was a strangely simple yet strangely impressive
wedding, never forgotten by those who saw it. When all was spoken
that was needed to make them man and wife, Bride stooped and
kissed her husband, without a thought of any who stood by, and they
heard the passionate intensity of love in the voice that responded—
“My Bride—my wife!”
CHAPTER XXIV
CONCLUSION
BRIDE was riding homewards from Pentreath to the castle on a
sunny day early in June. The sound of joy-bells was in the air, the
faces of men were glad and triumphant, all nature seemed in tune
with the general rejoicing which some recent event had plainly set on
foot; and the young wife’s face was glad, too, though thoughtfully
and temperately. For she knew that the news of which she was the
bearer would gladden the heart of her husband, though it would not
be to him now that source of triumphant exhilaration which it would
have been a year before.
Behind her rode the servant with a bag full of papers at his saddle-
bow. It was these letters and newspapers which had been the object
of Bride’s ride that day. Her husband had persuaded her to go
herself on the chance of news; he was always glad to make an
excuse to induce her to take the amount of needful air and exercise
which was good for her health, and she always found it so hard to
leave him.
But to-day she had been persuaded, and was now riding rapidly
homewards with her budget of news, knowing how impatiently her
husband and father at home would be awaiting her return.
Dismounting at the castle door, and taking the bag from the hands of
the servant, she passed hastily through hall and corridor into the
great conservatory, where Eustace was now daily wheeled upon his
couch. Since the beginning of May he had been taken down to a
ground-floor room in the wing which he and his wife occupied, in
order that, when possible, he might be taken out of doors, or into this
pleasant place of flowers. He had made as much progress as the
most sanguine could hope for during the past months, and recovery
was considered now only a matter of time and patience. Time and
patience were the only doctors for such a case as his, and Eustace
surprised all who came in contact with him by the extreme patience
and cheerfulness he showed under a condition of helplessness so
trying to youthful manhood; but he would say, with a smile, that Bride
made life too sweet for him for any repining to be possible. Each day
he found filled with happiness—the happiness of her presence, and
of that full community of soul which made their union what it was.
Every day brought its own measure of temporal happiness and
spiritual growth; and though the young man looked forward with
ardent expectation to the hope of being able to fight the battle of life
once more, and work in the service of his fellow-men, he recognised
fully and freely that this period of enforced idleness had been sent
him by the Father in mercy and love, and was resolved that the
lesson it was sent to teach him should not be learnt in vain.
The way in which his face kindled at the sight of his wife was a sight
good to see. She came quickly forward, bent over and kissed him,
and said softly—
“It is good news, Eustace. The Lords have passed the bill!”
“Ah!” he said, and drew a long breath. “I felt it would be so when the
King was obliged to recall Lord Grey. All parties must have known
then that the mind of the country was made up, and that the thing
was right, and must be made law. Have you read the news?”
“No; I only heard what they were all saying in Pentreath. I met many
friends, and they all told me something. The Duke of Wellington,
when he found the King would create enough new peers to pass the
bill, if that was the only resource left, retired from his place in the
House, and, some say, will retire from public life altogether. Lord
Wharncliffe and his party of waverers came over at once to the side
of Lord Grey, and so the bill was passed at once. The people are
wild with delight, the bells are being rung, and bonfires are being
built up. I sometimes wonder whether they really understand what it
is that they rejoice at. They seem to think that some wonderfully
good time is coming for them. Poor creatures! I fear they will be
disappointed. An act of constitutional justice has been done; but the
troubles of England lie far, far deeper than an imperfect system of
constitutional representation.”
Eustace was eagerly skimming the contents of newspapers and
private letters, and from time to time giving bits of information to his
wife; but the sense of her words came home to his mind for all that,
and by-and-bye, laying down the papers, he said—
“That is only too true, Bride. That is the very point upon which my
eyes have been opened latterly. I used to think that good
government and pure government was the backbone of a nation’s
prosperity and well-being—as in one sense of the word it is. I mean,
that if all men were doing their utmost to walk in the ways appointed
by God, we should have a pure and good government, and the
nation would prosper. But I see only too clearly now that I was quite
deceived in my old belief that this country and the world can ever be
renovated and made good by any scheme of political reform
instituted by man. We may do our best to be just and temperate, to
act uprightly, and think impartially of the interests of all classes; but
that alone will never raise them, never give them true happiness,
never lift them out of the degradation into which they, as well as too
many of us so-called ‘superiors,’ have fallen. There is only one
Power which can do that, only one Power mighty enough for that
task, and that is the Power of which I fear that we, as a nation of
politicians and upright rulers, think singularly little. The time may
come when we shall awake to the remembrance that God must be
Ruler in the earth if right and justice and equity are to be done; but at
present, though we listen to such words with approval from the
pulpit, we are absolutely ignorant how to put them into daily practice,
and our profession and practice are utterly at variance. That is where
our failure comes in, and where I, for one, foresee failure all along
the line. This bill may be the inauguration of an enlightened and
liberal policy for the next generation; but my old hope of seeing the
world raised out of its misery, its degradation, its wickedness by any
such means, is fading fast within me.”
Bride was silent for a while, looking out before her with a sweet sad
smile upon her fair face.
“It will not be achieved by such means,” she said quietly at last; “and
yet, if men would but look to the Lord for help and deliverance, I truly
believe He would show us the perfect way, and restore to us those
things which are lacking in the order of our daily lives, of our worship,
of our government. We know that the powers that be are ordained of
God; but we have lost so much of His guidance. Yet I verily believe
that if men would with one voice and one heart cry to Him for light
and guidance, He would send it to them, even as in days of old. Is
He not the same yesterday, to-day, and for ever? Though we have
forsaken Him, yet He has not forsaken us. As He spoke by holy men
of old, moved by His Spirit, so I truly believe He would speak again
had men but faith to listen. But it is that which is always the
stumbling-block—the hindrance. Men have lost their faith; they will
not believe that God is still amongst them, even as of old—nay, far
more truly and nearly than of old; for Christ is the living Head of His
Church, and all who believe and are baptized are very members of
His mystical Body. And yet we say He is far away, He has passed
into the heavens, He is no more working with and amongst us, save
through the workings of the Spirit in our hearts. But I feel so very,
very sure that, would we let Him, He would fain be much more to us
than that, as indeed He will be one day—in the day when the
Kingdom shall be set up on earth.”
Eustace drew a long breath. He, too, lying there in helplessness, and
seeing much of the brightness of his early visions fade into dimness
as he watched the course of events and learned to see more of the
workings of this world, had come to think with a great longing of the
coming Kingdom, when all that is vile and evil shall be done away,
and when Christ Himself shall be revealed and rule in righteousness.
Once that thought had seemed to him as the veriest vision of the
mystic; now he had come to long for it himself with a great and
increasing longing. Loving his fellow-men as he did, he yet loved the
Lord more; and to see Him reigning over the world, and the misery
and the sin all done away, was a prospect too bright and happy not
to excite his ardent longings. Even in his satisfaction at the news just
brought, he could yet think with calm hopefulness of the time when
the crooked things should be made straight, and the rough places
plain, and men should live together in peace and love, and strivings
and hatred should be done away.
“And until that day comes,” he said softly at last, “we shall do more to
help our brethren by teaching them to look for the Kingdom of God
and of His Christ, than by stirring up in their hearts desires after
earthly good which perhaps may never be theirs.”
Bride looked up with a sweet smile.
“Ah! that is just what I feel about it, Eustace; let us do all that is right
for them, but teach them to strive after contentment and love of God
themselves. That is the only thing that will really raise them or make
them truly happy.”
“Seek ye first——” said Eustace musingly, not finishing the
quotation, for there was no need. “After all, that is the best and
highest wisdom, though for eighteen hundred years men have had
the answer to their strivings and heart-burnings under their hand,
and have not known how to use it. You must help me, sweet wife, in
the future, when I go forth, as I trust by God’s mercy I may, to take
my place in the battle of life, and stand up for the right and the truth,
as I may be called upon to do, to bear in mind that great precept, for
without it we can accomplish nothing.”
Bride gave him an eloquent glance, but made no reply, for her father
was coming in, anxious to know the news.
She told her tale once more, and the papers were read and
discussed between the two men with eager interest. It was strange
how, by almost imperceptible degrees, those two had drawn together
—not entirely in opinion, but in mutual understanding and sympathy,
so that differences of opinion seemed trifles. Now it was real
pleasure to both to be together; and though they still argued and
disputed, it was in a spirit of toleration and mutual respect and liking
which made such argument pleasant and stimulating rather than
irritating. The Duke took a more despondent view of the future of the
country than Eustace, and had far less confidence in the success of
the coming era of more liberal principles of government for
redressing wrongs and bringing about a lasting state of prosperity
and peace; but then Eustace was far less sanguine about the
coming Utopia, far more patient and reasonable when existing
wrongs were discussed, far less confident in the powers of
legislation for the elevation of mankind than he once had been. Like
many other ardent young dreamers in the forefront of the battle of
reform, he had practically left out of his calculations the mystery of
original sin—the inherent corruption of men’s hearts, and their
perversity of vision, their determination to do evil until their eyes are
opened to see God’s dealings in all things, and their hearts are
purified by the Holy Spirit. No system, however perfect, will ever
make men righteous that does not first lead them to God. It was this
that Eustace had never realised before when he sought to raise men
by increased prosperity, and wiser and more just legislation. Now he
had begun to see the futility of his former dreams, and insensibly he
grew to sympathise with the feelings of his kinsman, who had lived
through so many crises of the world’s history, but had found at the
end that human nature was never changed, and that no era of bliss
and joy followed upon the violent efforts made to secure a better
order of things.
Leaving them to talk thus together and to discuss the situation to
their hearts’ content, Bride stole away into the garden, and wandered
along some of the shady paths, thinking her own thoughts, and filled
with a sense of profound thankfulness and joy in the unity of spirit
now existing between herself and her husband. It was the same daily
joy to her that it was to him, and her heart was charged with a peace
and restful content that sometimes seemed to her to be a foretaste
of the Kingdom itself, towards which her heart was always turning.
In one of the alleys of the rose-garden she came upon Abner, who
was tying up the young shoots upon the arch, and picking off the
dead blossoms. He welcomed her with the smile that the sight of her
always called up in his eyes, and stood still with a face full of interest
whilst she told him the news.
“Well, well, well,” he said when she had done, “may be it’ll be a good
thing. It sounds just, and right, and reasonable; but I don’t
understand these big matters, and there’s a deal to be said on both
sides, so far as I can see. My poor boy would have been pleased.
He was terrible set on it; but I used to think that when he got it, he
would find himself as discontented as ever, and set off after some
new teacher who would tell him this was only the beginning of what
men must demand. May be he sees things clearer now. I sometimes
think we’ll know a deal better what to think of such matters once we
are free of the burden of the sinful flesh. But there’s always comfort
in the thought that the Lord’s working in one way or another in all
these things. He sees the fulfilment of His purpose all through,
though we can’t. That’s what I comfort myself with when things seem
blackest. The frost and the snow, the biting winds and the storms, all
seem against the gardener; but by-and-bye he sees they all have
their use, and his plants would not have done as well without them. I
always go back to that when I’m perplexed and worried. The great
Gardener will bring out His perfected garden on the earth in time;
and it should be enough for us to be trying to help Him on in our little
corner, without thinking He can’t rule the world without us.”
Bride smiled as she answered softly—
“Yes; though perhaps He wants to use some of us for great tasks, as
He uses us all for little ones. But I know what you mean, Abner, and I
feel with you. We can never fully understand God’s purposes till they
are revealed to us in His perfect Kingdom; but we can all strive to
live the life of the Kingdom here below, as far as our sinful natures
will let us, and try to make just the little corner about us bear flowers
and fruit, as a garden should. I do not think we shall be called upon
for any great work. I think our lot will lie here, away in the west, in
this little place. But, for my part, I shall be content if we can bring the
hope and the life of the Kingdom into just this little corner of the
vineyard—to our sisters and brothers of St. Bride’s Bay.”
THE END
TRANSCRIBER’S NOTES:
Obvious typographical errors have been corrected.
Inconsistencies in hyphenation have been
standardized.
Archaic or variant spelling has been retained.
The cover image for this eBook was created by the
transcriber using the original cover as the background
and is entered into the public domain.
*** END OF THE PROJECT GUTENBERG EBOOK EUSTACE
MARCHMONT: A FRIEND OF THE PEOPLE ***
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.