Instant Download Foundations of PyGTK Development: GUI Creation With Python W. David Ashley PDF All Chapters
Instant Download Foundations of PyGTK Development: GUI Creation With Python W. David Ashley PDF All Chapters
com
https://textbookfull.com/product/foundations-of-
pygtk-development-gui-creation-with-python-w-
david-ashley/
https://textbookfull.com/product/foundations-for-analytics-with-
python-1st-edition-clinton-w-brownley/
textbookfull.com
https://textbookfull.com/product/foundation-dynamic-web-pages-with-
python-create-dynamic-web-pages-with-django-and-flask-david-ashley/
textbookfull.com
https://textbookfull.com/product/create-gui-applications-with-python-
qt5-pyside2-edition-martin-fitzpatrick/
textbookfull.com
https://textbookfull.com/product/copyrights-highway-from-the-printing-
press-to-the-cloud-second-edition-paul-goldstein/
textbookfull.com
Storey s Guide to Raising Rabbits Fifth Edition. Edition
Bob Bennett
https://textbookfull.com/product/storey-s-guide-to-raising-rabbits-
fifth-edition-edition-bob-bennett/
textbookfull.com
https://textbookfull.com/product/mullers-imaging-of-the-chest-2nd-
edition-christopher-walker/
textbookfull.com
https://textbookfull.com/product/daoism-in-early-china-huang-lao-
thought-in-light-of-excavated-texts-feng-cao/
textbookfull.com
https://textbookfull.com/product/the-new-couple-in-5b-a-novel-unger-
lisa/
textbookfull.com
https://textbookfull.com/product/induction-machines-handbook-
transients-control-principles-design-and-testing-3rd-edition-ion-
boldea/
textbookfull.com
Foundations
of PyGTK
Development
GUI Creation with Python
—
Second Edition
—
W. David Ashley
Andrew Krause
Foundations of PyGTK
Development
GUI Creation with Python
Second Edition
W. David Ashley
Andrew Krause
Foundations of PyGTK Development: GUI Creation with Python
W. David Ashley Andrew Krause
AUSTIN, TX, USA Leesburg, VA, USA
Introduction������������������������������������������������������������������������������������������������������������xxi
v
Table of Contents
Extending HelloWorld.py������������������������������������������������������������������������������������������������������������� 20
The GTK.Label Widget������������������������������������������������������������������������������������������������������������ 22
Layout Containers������������������������������������������������������������������������������������������������������������������ 23
Signals and Callbacks����������������������������������������������������������������������������������������������������������������� 24
Connecting the Signal����������������������������������������������������������������������������������������������������������� 24
Callback Methods/Functions������������������������������������������������������������������������������������������������� 26
Events����������������������������������������������������������������������������������������������������������������������������������������� 26
Event Types���������������������������������������������������������������������������������������������������������������������������� 28
Using Specific Event Structures�������������������������������������������������������������������������������������������� 28
Further GTK+ Methods���������������������������������������������������������������������������������������������������������������� 29
Gtk.Widget Methods�������������������������������������������������������������������������������������������������������������� 30
Gtk.Window Methods������������������������������������������������������������������������������������������������������������ 31
Process Pending Events�������������������������������������������������������������������������������������������������������� 33
Buttons���������������������������������������������������������������������������������������������������������������������������������������� 33
Test Your Understanding������������������������������������������������������������������������������������������������������������� 36
Exercise 1: Using Events and Properties������������������������������������������������������������������������������� 36
Summary������������������������������������������������������������������������������������������������������������������������������������ 37
Chapter 4: Containers��������������������������������������������������������������������������������������������� 39
GTK.Container����������������������������������������������������������������������������������������������������������������������������� 39
Decorator Containers������������������������������������������������������������������������������������������������������������� 40
Layout Containers������������������������������������������������������������������������������������������������������������������ 40
Resizing Children������������������������������������������������������������������������������������������������������������������� 41
Container Signals������������������������������������������������������������������������������������������������������������������ 42
Horizontal and Vertical Boxes����������������������������������������������������������������������������������������������������� 42
Horizontal and Vertical Panes����������������������������������������������������������������������������������������������������� 48
Grids�������������������������������������������������������������������������������������������������������������������������������������������� 52
Grid Spacing�������������������������������������������������������������������������������������������������������������������������� 54
Fixed Containers������������������������������������������������������������������������������������������������������������������������� 54
Expanders����������������������������������������������������������������������������������������������������������������������������������� 57
vi
Table of Contents
Notebook������������������������������������������������������������������������������������������������������������������������������������� 60
Notebook Properties�������������������������������������������������������������������������������������������������������������� 62
Tab Operations����������������������������������������������������������������������������������������������������������������������� 63
Event Boxes�������������������������������������������������������������������������������������������������������������������������������� 64
Test Your Understanding������������������������������������������������������������������������������������������������������������� 69
Exercise 1: Using Multiple Containers����������������������������������������������������������������������������������� 69
Exercise 2: Even More Containers����������������������������������������������������������������������������������������� 70
Summary������������������������������������������������������������������������������������������������������������������������������������ 70
vii
Table of Contents
viii
Table of Contents
Exceptions��������������������������������������������������������������������������������������������������������������������������������� 167
Raising Exceptions�������������������������������������������������������������������������������������������������������������� 167
Catching Exceptions������������������������������������������������������������������������������������������������������������ 170
Raising and Reraising Exceptions��������������������������������������������������������������������������������������� 171
Catching Multiple Exceptions���������������������������������������������������������������������������������������������� 172
ix
Table of Contents
x
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Table of Contents
xi
Table of Contents
xii
Table of Contents
xiii
Table of Contents
Index��������������������������������������������������������������������������������������������������������������������� 561
xiv
About the Author
W. David Ashley is a technical writer for SkillSoft, where he
specializes in open source, particularly Linux. As a member
of the Linux Fedora documentation team, he recently led
the Libvert project documentation and wrote the Python
programs included with it. He has developed in 20 different
programming languages during his 30 years as a software
developer and IT consultant. This includes more than
18 years at IBM and 12 years with American Airlines.
xv
About the Technical Reviewers
Jonathan Giszczak is a professional software developer with
extensive experience writing software for the military and
financial services industries, as well as the game industry.
He graduated from the University of Michigan with a degree
in computer engineering. He has been writing C, C++, and
Python applications since the 1990s, including applications
in Motif and PyGTK.
xvii
Acknowledgments
I would like to express my gratitude to the many people who have made this book
possible. Many thanks go to Daniel Berrange of Red Hat, whose assistance has certainly
decreased the number of errors in the book. I would also like to thank Peter Gill and
Jonathan Giszczak for their fine technical reviewing skills. You were very tough on every
paragraph I wrote and every example I coded, but this book is better today because of
the hard work you put into the project.
I would like to extend a special thanks to Andrew Krause for his encouragement and
help. Without him, this update to his original book would not have been possible.
In addition, I would like to thank the people at Apress who put so many hours of
hard work into the book. I could not imagine writing for any other publisher. It is a great
organization that makes the writing process enjoyable.
Finally, I need to acknowledge my wife, who has supported me in every step of the
process. Without you, I would not be who I am today and for that I am forever grateful.
xix
Introduction
One of the most important aspects of an application is the interface that is provided to
interact with the user. With the unprecedented popularity of computers in society today,
people have come to expect those user interfaces to be graphical, and the question of
which graphical toolkit to use quickly arises for any developer. For many, the cross-
platform, feature-rich GTK+ library is the obvious choice.
Learning GTK+ can be a daunting task, because many features lack documentation
and others are difficult to understand even with the API documentation. Foundations
of PyGTK Development aims to decrease the learning curve and set you on your way to
creating cross-platform graphical user interfaces for your applications.
Each chapter in this book contains multiple examples that help you further your
understanding. In addition to these examples, the final chapter of this book provides
five complete applications that incorporate topics from the previous chapters. These
applications show you how to bring together what you have learned to accomplish in
various projects.
Each chapter starts with an overview, so that you are able to skip around if you
want. Most chapters also contain exercises to test your understanding of the material. I
recommend that you complete all the exercises before continuing, because the best way
to learn GTK+ is to use it.
At the end of this book, there are multiple appendixes that serve as references for
various aspects of GTK+. These appendixes include tables listing signals, styles, and
properties for every widget in GTK+. These appendixes will remain a useful reference
after you have finished reading the book and begin creating your own applications. In
addition, Appendix D explains the solutions to all the exercises in the book.
xxi
Introduction
xxii
Introduction
while also covering signals, callback functions, events, and child widgets. You then learn
about widget properties and the Gtk.Button and Gtk.Label widgets.
Chapter 4 begins by introducing the Gtk.Container class. Next, it teaches you about
horizontal and vertical boxes, grids, fixed containers, horizontal and vertical panes,
notebooks, and event boxes.
Chapter 5 covers basic widgets that provide a way for you to interact with users.
These include toggle buttons, specialized buttons, text entries, and spin buttons.
Chapter 6 introduces you to the vast array of built-in dialogs. It also teaches you how
to create your own custom dialogs.
Chapter 7 is a general overview of the most useful features of Python. It covers many
Python features that are directly useful to the GTK+ programmer but not necessarily
covered in depth in many Python introductory texts.
Chapter 8 introduces you to scrolled windows. It also gives in-depth instructions on
using the text view widget. Other topics include the clipboard and the Gtk.SourceView
library.
Chapter 9 covers two types of widgets that use the Gtk.TreeModel object. It gives an
in-depth overview of the tree view widget and shows you how to use combo boxes with
tree models or strings.
Chapter 10 provides two methods of menu creation: manual and dynamic. It covers
menus, toolbars, pop-up menus, keyboard accelerators, and the status bar widget.
Chapter 11 is a short chapter about how to design user interfaces with the Glade user
interface builder. It also shows you how to dynamically load your user interfaces using
Gtk.Builder.
Chapter 12 teaches you how to create your own custom GTK+ widgets by deriving
them from other widgets.
Chapter 13 covers many of the remaining widgets that do not quite fit into other
chapters. This includes several widgets that were introduced in GTK+ 2.10, including
recent files and tray icon support.
Chapter 14 gives you a few longer, real-world examples. They take the concepts you
have learned throughout the book and show you how they can be used together.
The appendixes act as references to widget properties, signals, styles, stock items,
and descriptions of exercise solutions.
xxiii
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Introduction
xxiv
CHAPTER 1
Getting Started
Welcome to Foundations of PyGTK Development. In this book, you acquire a thorough
knowledge of the GIMP Toolkit (GTK+), which allows you to create comprehensive
graphical programs. Before continuing, you should be aware that this book is aimed at
Python programmers, so we assume that you already have a good understanding of the
Python language, and you can jump right into using GTK+. Time is not spent on bringing
you up to speed on Python.
To get the most out of this book, you should follow each chapter sequentially and
study all the examples in each chapter. Getting started with GTK+ on Linux is very easy
because most distributions are bundled with everything you need to create and run
Python/GTK+ programs. We cover Windows and macOS installation procedures later in
this chapter.
There are a few tools that should be installed to get you started without running
into trouble. First, Python 3.x should be installed. It is required to run GTK+ 3.x Python
programs. Second, the GTK+ 3.x runtime libraries should be installed. These libraries
come with many dependencies installed, including GObject, Pango, GLib, GDK,
GdkPixbuf, and ATK. Be sure to install all the dependent libraries.
You do not need to install the GNU Compiler Collection. You are not compiling any
C/C++ programs in the examples provided in this book. You only need Python 3.x and
the GTK+ 3.x runtime libraries to be installed to run the example programs.
1
© W. David Ashley and Andrew Krause 2019
W. D. Ashley and A. Krause, Foundations of PyGTK Development,
https://doi.org/10.1007/978-1-4842-4179-0_1
CHAPTER 1 Getting Started
The reason for most of these changes is due to a change in the GTK+ philosophy. The
GTK+ 2.x libraries were designed around consistency between all GTK+ programs, with
the use of GTK+ themes as the basis for that consistency. This philosophy completely
changed with the GTK+ libraries. While themes are still available, it is now easier to
create GTK+ programs that have their own look and feel separate from the current
GTK theme. While this gives the developer greater control, it also requires some extra
programming steps to achieve the look and feel. It also removes some APIs that make a
widget easy to create and control.
The following is a partial list of the differences between GTK+ 2.x and 3.x. Some of these
items have simple workarounds, but others require a little more work on the programmer’s
part because they are different enough to cause source code porting problems.
• Many standard stock icons have been removed, mostly the ones used
on push buttons and menu items. If you need these icons, you must
provide your own set.
• All the 2.x constants are now grouped in a 3.x Python class as
attributes. If you are porting source code, this is a major area that
needs to be addressed.
• Some standard dialogs have been removed. You must create your
own dialogs to replace them.
• There are two new major classes that are very useful for the overall
control of large and small applications: the Gtk.Application class
and the Gtk.ApplicationWindow class. While these classes are not
strictly needed for simple applications, you still find them useful
for even the simplest of applications. For that reason, we base all
the examples in this book on these two classes to wrap our widget
examples.
2
CHAPTER 1 Getting Started
/usr/bin/gtk3-demo
If the program exists and the widget documentation window appears, then the GTK+
installation was successful.
S
ummary
This chapter introduced GTK+ Version 3.x and Python 3 along with some installation
prerequisites. It presented some post-installation tests to ensure that GTK+ was
successfully installed. And it discussed some differences between GTK+ 2.x and 3.x.
After successfully installing GTK+ 3.x and Python 3, your environment should be
ready to build your first Python/GTK+ program.
Chapter 2 further discusses Gtk.Application and the Gtk.ApplicationWindow, the
base classes that you should use for all Python 3 GTK+ 3.x programs.
4
Random documents with unrelated
content Scribd suggests to you:
defence of which was still committed to our shattered regiment by Sir
Alexander Leslie, who put implicit trust in us. I had it dressed by a passing
surgeon, as I had no wish to risk myself near the frightful hospitals; and, on
the firing ceasing, I went to visit Ernestine.
I found her in the little boudoir, and there was something about it and her
too, that alarmed me; but then, perhaps, I was weak and nervous; provisions
were so scarce that, though she knew it not, I had tasted nothing for two
days. She was reclining in a large gilded fauteuil of yellow damask, stuffed
with down, and her tiny feet rested on a tabourette of the same.
The room was darkened by the blinds being closely drawn; but the
windows were open, and through them there swept a warm breeze, that
played with the heavy hangings of velvet, and wafted the perfume of
flowers from a large stand of green-painted wood bearing three rows of
Dresden china vases, each containing the few flowers of the season.
She was dressed in white satin, brocaded with red flowers; it was a dress
I had given her; and to please me, doubtless, she had put it on, together with
a pair of beautiful pearl bracelets, for which I had given to one of Karl's
pistoliers six dollars, without asking him any questions.
"Dear Ernestine, you are unwell!" said I, on perceiving that she made but
a languid motion of her hand as I approached her.
"No, no!" she replied; "but the memory of all I saw yesterday affects me
still—and these decayed flowers, perhaps—there, thank you," she added, as
I flung the flowers referred to into the street.
She looked very pale, and I thought the tone of her voice was altered.
Next day she was even paler, and her languid air was unmistakeable. The
room was shaded as before, and she sat near the half-opened window, to
enjoy the cool breeze that swept over the Sound of Rügen. I hoped it was
merely the deprivation of many little luxuries with which I had contrived to
furnish her, long after every one else in Stralsund had ceased to think of
them. Prudentia and her spouse had kindly sent me some of these things;
but a few days before I had visited the shop at the corner of the Bourse, and
found it closed, with a red cross chalked on the door. The plague had been
there, and the drivers of the death carts were to call for the dead on their
way to the trenches.
She remained with her left cheek resting upon her hand, and when
caressingly I attempted to kiss it, I felt as if an arrow had pierced my heart,
on perceiving that which she had been striving to conceal from me—a
round hectic mark, about the size of a dollar.
Some frivolous remark, the natural impulse of a toying lover, died away
on my lips as I saw this horrible mark, and with agony became convinced
that the finger of death had printed it there. I glanced at her face.
It seemed so much paler since yesterday! It was cold, frozen, and sad
looking, even when she strove to smile. Its beauty had become severe, and
she seemed taller than usual in her long white stomacher. In that darkened
room she looked like a white spirit, or a statue of snowy marble. Her eyes
had lost their beautiful language. Sadness, intense sadness, alone remained.
"Ah! do not touch me," said she, withdrawing her hand; "leave me,
Philip—leave me now!"
She was delirious, and imagined herself with Gabrielle and her father.
Her once beautiful eyes had become bloodshot and red as coral; there was a
little line of foam round her lips, and spots of purple were on her cheeks
and brow.
Oh, the agony of a sight like that! Honest Pennicuik, hurried me roughly
but kindly out of her apartment, and, thrusting me into a fauteuil, made me
drink a glass or two of his medicated hospital wine.
Let me hurry over the relation and the memory of those sad hours of
hopeless sorrow and futile anxiety.
On the second day, the fever and the delirium passed away, and I was
permitted to see her; for Father Ignatius, with more than usual gravity on
his long and solemn face, came to tell me that she was dying.
Dying! The good man gave me his arm, for I was very weak, and a
partial blindness had come over me. I hoped it was the plague, that I might
go with Ernestine; but, alas! it was only the result of sheer hunger, grief,
and excitement.
Kneeling down by the side of the bed, I stooped my brow upon her thin
wan hand, and wept as if my heart would burst. Ernestine also wept, but in
silence; tear after tear rolled over her hollowed cheek, for she was too
feeble to raise her head, and we muttered only incoherent sentences of
sorrow and endearment—which it were useless to commit to paper; for to
some they might seem exaggerated—to others perhaps too cold and
passionless; as I can neither impart to them nor to the reader, the agony that
thrilled our hearts, though the memory of that keen agony yet lingers in my
soul, like an old and painful dream.
In expression her eyes were sad and fixed; there was a smile of ineffable
sweetness playing about her thin white lips; but the dew of death was on her
brow and about her braided hair. Believing that she was about to rejoin her
sister, the poor girl said to me—
"I have been praying for you, and for myself—thus, like St. Monica,
sending my most pious thoughts as harbingers to heaven. I am going to
Gabrielle—ah, how she loved me!"
I could only murmur her name; then she put forth her dear lip
affectionately for one more kiss. I became bewildered, and an emotion of
wild satisfaction stole into my heart.
"'Tis the plague—it has seized me, too!" I muttered joyfully. "Dear
Ernestine, I will soon follow you!"
The film was again spreading over my eyes, and there was a hissing in
my ears; yet I felt the cold hand of Ernestine clasped in mine, and knew that
its grasp was relaxing.
Then I heard the voice of honest Father Ignatius saying in my ear, and
with a voice rendered husky by emotion—
"She is dead—God receive her sinless soul! close her eyes, and kiss her,
Philip—all is over now."
At that moment I heard the wheels of the dead cart rattling over the
street, and the jangle of its hateful bell.
****
Next day I recovered, as one who awakes from a deep sleep, and all the
events of yesterday rushed like a torrent of grief and pain upon my mind.
Father Ignatius, who had relapsed into his immobility of aspect and
demeanour, knelt at the fauteuil, reading his daily office out of a little brass-
bound breviary, which he closed the moment I moved. I was lying on the
floor, with a cloak spread over me.
I stood in the chamber of death, and there was in it an awful stillness that
deeply impressed me.
She was dead—this being, whom I had loved with my whole heart, and
with my whole soul, was dead! yet I had neither a prayer nor a tear. I could
neither form one, nor yield the other. I was frozen—stunned! She was dead!
and these three words seemed written before me every where; there was a
horrid stillness in my heart, and in every thing around me. The whole world
seemed to be standing still; and what was now my Ernestine?
I looked upon her, but could not realize her death. The dark hair, which
she was wont to dress so gracefully, was smoothed in modest braids over
her pale and stonelike brow. They were very still—those glossy braids; and
not a breath of air disturbed them, though the breeze lifted the leaves of her
now neglected flowers. Her birds were chirping near, for their seed-boxes
were empty now; the Jesuit observed this, and, notwithstanding all his
sternness, even at that dreadful time he filled them, for the old man's heart
was a very kind one.
"Oh, can this indeed be her who loved me so well!" was frequently my
mental exclamation.
Oh, for one more glance—one respiration more! But the horrible
stillness was unbroken; decay would come, but never again a glance or a
smile.
I feared I would become mad, and so forget all about the plague and the
siege; but I never left her side until the second day, when a tremendous
salvo from the camarade battery made my heart leap within me; and then I
heard the rattling drum and the yelling bagpipe summoning our soldiers to
the walls. A new thought seized me!
I kissed her soft cheek, and that cold lip, whose icy touch sent a thrill of
horror and agony to my heart; then, grasping my claymore, I threw myself
at the head of my company, and rushed to the last defence of the
Frankendör, with a deep and settled resolution to fall—to die!
CHAPTER XLVII.
I found that a salvo had completely breached the curtain of the bastion at
the Frankendör; that the debris of fallen masonry, wooden platforms,
cannon and their carriages, had half filled up the ditch before the gap; and
that a strong column of Imperialists were advancing to a general assault, led
by several officers on horseback, one of whom wore that large red plume
for which the Count of Carlstein was so remarkable. Another, who was
generally by his side, rode a magnificent white horse, and wore a cuirass
and helmet which glittered like silver in the sun, being of the most beautiful
workmanship; while his scarf, gloves, holsters, and housings, were fringed
with the richest bullion.
This cavalier was the great Duke of Friedland himself, and the place
where he rode, at the head of that advancing column, was the mark of
nearly a thousand muskets; for the Lord Spynie's regiment of Lowland
Scots was now brigaded with ours, but both were greatly reduced in
number; and a line of hollow-eyed and pale-visaged men they were; yet as
desperate as the most resolute valour, goaded by starvation and disease,
could make them.
Within that coffin was Merodé, whom De Vart had slain by a mortal
wound; but whose dying injunctions were, that, dead or living, he should
head the assault of Stralsund. Ruffians though they were, his soldiers had a
wild species of love for him; and now sword in hand, and shoulder-high, six
of them bore his coffin towards the breach, the fire from whence, by
frequently killing the bearers, threw the dead man heavily on the earth.
"Gentlemen and comrades," said Sir Donald; "pikemen and musketeers
—to your duty, and do it according to your wont! Remember how many
generations of our ancestors, all brave men, who loved the battle as a
pastime, are this day looking down upon you from the place of the good
man's reward in heaven."
"Dirk and claymore! dirk and claymore!" cried our men, and the shout
was heard above the roar of the musketry.
"Yes!" said Ian emphatically, as he shook his lofty plumes; "in Heaven's
name let it be dirk and claymore! I would rather meet those fellows hand to
hand, in the good old Highland fashion, than by bandying bullets from
behind a stone-dyke. Let us this day save Stralsund, or perish with her!"
"Ian," said I, "you have still something to live for. Remember Moina!"
"Then why throw it heedlessly away? Do you live for her? 'Tis enough
for the wretched to perish."
On this day of carnage and desperation the world was looking as bright
as ever. The walls of the old city were smiling in the sunshine, and its
ruddiest glow fell on the ancient church, within the walls of which there
was the greatest amount of suffering. Though the season was advanced, the
noon was somewhat sultry, and swarms of new-born gnats were wheeling in
the sunny air. The young green grass was sprouting above the trenches
where the dead were buried; the Sound was like a blue mirror, and clouds of
fleecy whiteness flecked the wide azure dome of the sky. All nature looked
beautiful, and the glad earth seemed to smile back on the bright sun; but
man, in his Wickedness, was doing all he could to render that beautiful
Earth—a Hell!
I had just come from the lifeless Ernestine, and hence, perhaps, this
moralizing for a moment; but I was dogged and desperate; selfishly caring
not who fell, or who survived—who might be victorious, or who
vanquished. The world and I had no longer any thing in common; and now
the uproar and strife that deepened round me as the foe drew near, were a
congenial relief to my tortured spirit; for it rose, as it was drawn away from
bitter thoughts, and my heart leaped at the rattling musketry, the shrieks,
cries, and moans of the wounded, the tumultuous shouts of the combatants
as they closed up shoulder to shoulder in the breach, where our Highlanders
shot, with rapid and deadly precision, right over the heads of a stand of
Spynie's Lowland pikes, whose gallant breasts had replaced the fallen
bastion.
On came that triple column of the foe, and now one high discordant yell
announced that they were within pistol-shot; but so thick was the smoke
before us that we could scarcely see them. The wild Merodeurs made
incredible efforts to bring on the coffin of their colonel, and seemed to
enjoy the strange bravado of being led by a corpse to the assault; but every
relay of soldiers who lifted it from the earth were shot down in succession,
until at last the coffin, with its bearers and hundreds of others, tumbled pell-
mell into the ditch, before the breach, the way to which became literally
choked by the bodies of the killed and wounded; and over these the rear
companies of the Merodeurs, and Camargo's Spanish pikemen, rushed
mingling to the assault, like a flood of valour and fury.
But the flood was stemmed, and that fury curbed by the hedge of
Scottish pikes that met them in the breach, and the Spaniards and Germans
were rolled back on each other, until the front ranks were literally hurled
headlong on the rear. In vain, by clubbed muskets, by hewing with swords,
and by grasping with the bare hand, they strove to beat, to cut, or tear a
passage through the soldiers of Lord Spynie. The finest chivalry of
England, of Normandy, and Acquitaine, had failed, on fields of more than
European renown, to force a passage through a rampart of Scottish pikes;
and now, assuredly, that honour was not reserved for the Imperialists of the
Duke of Friedland. Some, however, were torn out of Spynie's ranks, and
slain or taken prisoner; among the former was the son of the Laird of Leys,
first private gentleman of a company; and, among the latter, Sir John Hume
of Aytoune, in the Merse. He was dragged by the throat and waist-belt into
the midst of the enemy, by whom he was barbarously slashed and wounded.
Over the heads of Spynie's men, and closing up into their ranks, our
Highland musketeers poured their bullets point-blank into the faces of the
stormers; while our brass cannon, from an angle of the bastion, raked their
column in flank. Here they slew many of our best men; and Lumsden, my
lieutenant, Captain M'Donald, of the house of Keppoch, and nearly three
hundred gallant clansmen, fell to rise no more. We shot down all the
mounted officers, save those two who had been so conspicuous, one by his
red plume, the other by his snow-white horse; and, during the lulls of the
smoke and uproar, they were to be seen and heard encouraging their
soldiers, by precept and example, to push on, and to die rather than flinch.
But they seemed to bear charmed lives, and though innumerable shots
were fired at them through openings in the smoke, they were never hit; and
now, fortunately for us, at the very moment our ammunition was beginning
to fail, the enemy began to waver; and at such a time, and on such a duty, to
waver is but a prelude to flight. They gave way on all hands, and retired
with precipitation round the right flank of the Frankenlake, leaving behind
them a terrible scene of carnage and destruction.
The killed lay in hundreds, and the wounded screaming for water,
groaning, rolling, and throwing up their hands and feet, lay in hundreds
more, among scattered arms, drums, standards; and then the horrors of the
fosse, where a seething mass of living and dead lay piled over each other,
head and heels, endwise and crosswise, trod upon, and pierced in a
thousand places by the storm of shot that had augmented their number
every moment, piling up a hecatomb of slain above the abandoned coffin of
the once terrible and reckless Merodé! Among their fallen riders, even in
the ditch, as well as on the approach thereto, lay many noble horses,
maddened by pain, kicking, plunging, snorting, and shrieking (for a horse,
at times, can utter a frightful cry), as they rolled over the helpless wounded,
with their iron hoofs breaking legs and ribs, or beating out the brains of
those whom the musket-shot had already maimed elsewhere. Use and wont
made us regardless of this scene; and now we were sufficiently attracted by
another.
While the fugitives were retiring round the angle of the Frankenlake, the
two mounted officers already mentioned, were frequently seen
endeavouring to rally them, and placing their horses before the flying
bands; but they might as well have striven to stay the waves of ocean. At
last they appeared to quarrel with each other; we saw their swords gleam as
blows were given and thrusts exchanged; their horses reared up, and then
plunged past each other; a blade flashed in the sun, and the cavalier on the
white horse was struck from his saddle; his charger galloped away, and
while he had to limp after his soldiers on foot, the officer with the red
plume came galloping madly back towards the breach, waving a white
handkerchief to us in sign of truce or peace. Several shots were fired after
him by the Merodeurs, but, escaping them, he cleared the corpse-
encumbered ditch by one terrific bound, and forcing his noble horse up the
rough avalanche of masonry, dismounted in the midst of us, breathless,
panting, pale with excitement, anger, and exertion.
The count spoke with bitterness, and breathed hard as he leaned on his
sword, and our regiment closed round him with surprise and inquiry.
Unwilling to tell what I knew would be as poniards in his heart (the fate of
Ernestine), I stood a little in the background; while Marshal Leslie, Sir
Donald Mackay, and Lord Spynie, all together inquired the cause of quarrel
with his general. After taking a sip or two of brandy from the flask of Ian
Dhu, and retiring a little apart from the vicinity of the breach—
"You are well aware, gentlemen," said he, "how signal has been the
success attending the arms of the emperor and princes of the Catholic
League. Driven from Juteland, Christian IV. has been glad to seek shelter by
sea, and by wandering among the Danish isles, and the career of conquest
has only been stopped by the waters of the Baltic——"
How truly the count had judged of the character of the great Duke of
Friedland (or the Archduke of Mechlenburg, as he was generally styled for
a time), after events have shown; for they brought to pass that dark scene in
the Bohemian Castle of Eagar, where the Scottish colonels, Leslie and
Gordon, were compelled to hew off his head in the banqueting hall.
"Ah! here is my friend and namesake, Captain Rollo," said the count,
approaching me; "and so, comrade, you have still preserved the gold chain I
gave you on that moonlight night by the marshy Elbe. But what is the
matter? you look pale as Banquo's ghost. I see starvation in every eye here.
Now lead me to my poor girl—the last that fate has left me; for if I have her
in my arms, the county of Carlstein, the castles of Giezar and Kœningratz,
with all my orders of knighthood and nobility, and my colonel-generalship
of the Imperial Cavalry, may go to the devil for aught that I care. Ha—what
is this?"
CHAPTER XLVIII.
We entered the room where she lay, and the stillness of death was there.
We approached her with reverence; and when I stretched my hand towards
the veil that covered her, it was with the air of a monk displaying the
sacrament, for the remains of those we love are to us the holiest of all holy
things.
We stood silent, for our hearts swelled with the most intense sadness,
and were filled by the memory of the past.
Language cannot portray what the count felt, for the shock was so
sudden. Within one hour his pale cheek had sunk; his eyes were inflamed,
and his voice trembled. The very profundity of the poor father's affliction
had dried up the ordinary channels of grief, and thus no tear escaped to
relieve his agony.
The face of Ernestine had still its unpleasant expression, and yet, amid
its awful stillness, I could have sworn a spasm contracted it.
The coffin was preparing; two of Spynie's soldiers were making it.
For a time the count was like a statue; frozen, impassible. I have said his
grief was of that kind which had neither tears nor words. It escaped in deep,
dry, agonizing sobs, and he clenched his nether lip with his teeth till the
blood came.
"Blessed God, thou triest me sorely! Both are gone! both gone now!—
and I am alone in this wide, dreary world again. At my age 'tis said we
cannot weep."
In brief terms, I informed the count of the relationship between us, and
how Ernestine and I had discovered at Nyekiöbing, that he was my long lost
uncle, Philip—and she my cousin. He gazed at me as if he thought I raved;
then he seemed to be convinced, and then dismissed it from his mind; for
surprise, regard, and all minor emotions, had shrunk before the tornado of
great and overwhelming grief.
"How long has she been dead?" he asked, in a low and husky voice.
The tears now burst from the eyes of the old soldier, and, stooping over
the body, he embraced and kissed it.
I sprang to his side, and clasped one of her hands in mine. It was quite
warm!
There was a convulsive motion in her fingers and feet; she opened her
eyes, and a faint sigh escaped her; joy and terror bewildered me for a
moment. Then I rushed away in search of a surgeon. Hurrying through the
streets bareheaded, and without sword, scarf, or doublet, the first I met was
no other than old Pennicuik. He thought me seized by delirium; but
accompanied me without delay to the room of Ernestine, who seemed to be
again hovering between life and death.
How dimly and confusedly that new day of terror, grief, and joy floats
before me! I was like one who suffered from vertigo; I do not think I had
the full use of my senses. Pennicuik immediately ordered all the windows to
be opened; he took the pillows from under her head; he bathed her temples
with Hungary water, eau de luce, and warm brandy; he spunged her little
hands and snow white arms in vinegar and warm water; and a little wine
was gently poured between her lips. Then, after the fashion of the female
nurses at the Altenburg hospital, he blew air into her lungs by the nostrils.
She had dreamed that she was dead, and yet was sensible of all that
passed around her. At times it seemed as if her spirit left her body, and yet
remained near it—appearing to hover over that which it had no longer the
power to move. When I kissed her, and closed her eyes, she had felt the
touch of my hand without having the power of opening her eyes again. The
horror of being buried alive occasioned her the utmost agony; and when she
heard persons moving about her—when she heard sounds in the street,
especially the jangle of the death-cart bell, her unexpressed agitation was
terrible; but her soul could no longer act upon her fettered tongue, and she
felt icy cold. Hence those spasmodic contractions of feature which I had
actually seen, but thought were the result of my own disturbed fancy. The
approach of her father, and the sound of his voice, gave a new impulse to
her almost prostrate mind; it resumed its wonted power over her weakened
organisation, and produced the sudden warmth which had startled him,
when he thought he was embracing her for the last time.
After thanking us for our services, he bade us adieu, and I saw the tears
glisten in the only eye that war had left him. He sailed—not to rejoin his
queen, who always met him with coldness in his reverses—but to seek the
society and solace of the fair Countess of Fehmarn, his wife of the left-
hand; who, whether in victory or defeat, had ever welcomed him with joy,
gratitude, and love.
Repulsed, as related, in his last attempt to obtain Stralsund by assault,
the great and ambitious Duke Albrecht, after a four months' siege, in which
he lost upwards of twelve thousand of his best and bravest soldiers, was
compelled to spike his cannon, burn his camp, destroy his baggage, and
retreat into Saxony, thus acknowledging that neither his skill nor his mighty
host had availed him before the valour of Marshal Leslie's Scottish garrison.
The plague passed away with him, and health, happiness, (and fresh
provisions,) all flowed together into Stralsund. The good and industrious
citizens resumed their wonted occupations; and, so sensible were they of
the protection our swords had afforded, that they made old Field-marshal
Leslie a magnificent present of silver-plate, and ordered medals* to be
struck in honour of the Scottish troops.
"I am now sick of war," said he; "and, as King Jamie said of old, have a
salmon-like instinct to revisit the place of my nativity."
Aware that reverses of fortune might one day come upon him, and that
his estates of Carlstein, Giezar, and Kœningratz in Bohemia, were perhaps
little better than so many castles in the air, the count, like a wary old soldier,
had gradually secured vast sums in the hands of those famous and wealthy
merchants, Thomas Watson of Leith, and Herr Dübbelsteirn of Glückstadt.
Thus he was as independent of the family at Craigrollo as I; for, on my
marriage with Ernestine (which we had arranged should take place in the
old kirk of St. Regulus at home), I would receive a handsome share of the
count's prize-money, which would form a very reputable estate, the more so
if we could secure the two baronies of poor Kœningheim; but I feared that
would be no easy matter, as various real or imaginary relations had already
possessed themselves of all his towers and places of strength.
I shall never forget the day on which we marched from Stralsund; for we
all embarked together. My dear comrades to enter on the long and glorious
career of the new German war; Ernestine, the count, Ian, and myself, with
Phadrig Mhor, to return to old Scotland; for Ian was to be married to his
Moina, and Phadrig remembered that there was a lint-locked lassie in
Strathdee, who would be very well pleased if again he came back to her and
the green forests of Braemar.
Ernestine had fully recovered, and had become more beautiful and
radiant than ever.
She wept when honest Father Ignatius lifted up his long bony hands and
blessed her, before departing, staff in hand, as he said, "like St. Argobastus
the Scot," on his lonely pilgrimage after the Imperial host.
The Swedish fleet lay at anchor in the Sound to receive the regiment,
which my heart bled to leave.
The good ship Scottish Crown, with all her sails loose, and a spring upon
her cable, waited to receive us.
On one side lay the deserted trenches and dismantled batteries of the
discomfited Wallenstein; here lay a brass cannon with the moss upon its
muzzle; there a mound, where the fresh grass sprouted above the calm
repose of the dead, and the autumn flowers expanded in the morning
sunshine.
On the other side rose busy Stralsund, its shining walls decorated by
silken banners, and its church-bells tolling merrily; for now, war, disease,
and desolation, had passed away together.
Between, lay the blue waters of the narrow Sound, where the white sails
of the Scottish and Swedish ships were flapping in the morning wind.
By the round archway, by the stony streets, and the frowning bastions,
our hoarse drums beat merrily, and the shrill fife, with the proud war-pipe
of the Gaël, rang upon the breeze; the green tartan waved, and the silken
banners with the Red Lion and the Silver Cross rustled above our heads. All
our hearts beat high with hope and ardour; and yet it was not without a sigh
of regret for the brave Scottish hearts that had grown cold for ever beneath
Jaromar's walls, that we marched down to the crowded and sunny beach for
embarkation.
NOTES.
Some account of the Scottish troops who went to Denmark about 1625,
will be found in the "Memoirs of Sir John Hepburn," recently published by
the author of this work. They appear to have mustered as follows:—
Men.
The regiment of Sir Donald Mackay of Farr
1500
Colonel Sir James Leslie's regiment
1000
Alexander Seaton's
500
The regiment of the Earl of Nithsdale, three Batts
3000
The regiment of Alexander Lord Spynie, three Batts
3000
The regiment of Sir James Sinclair of Murkle, ditto
3000
These 12,000 men were independent of 3000 sent by Scotland to the Isle
Rhé, and about 13,000 more who entered the service of Gustavus Adolphus,
while at the same time many of the Scottish Catholics flocked to the
standard of the Emperor Ferdinand II.
The idea of this quaint heirloom is taken from a similar one preserved by
the ancient family of Crauford of Cowdenhill. It is of silver, measuring
three inches wide in the mouth, and inscribed—
MACKAY'S OFFICERS.
Captain Andrew Munro, also wounded there; and afterwards slain in single
combat by the Count of Rantzau, in the Isle of Fehmarn.
The regiment had more than 30 officers killed and wounded in three
years; and lost more than 1000 privates in the same short space of time.
THE END.
Updated editions will replace the previous one—the old editions will
be renamed.
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.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.