Instant ebooks textbook Modern PyQt: Create GUI Applications for Project Management, Computer Vision, and Data Analysis Joshua Willman download all chapters
Instant ebooks textbook Modern PyQt: Create GUI Applications for Project Management, Computer Vision, and Data Analysis Joshua Willman download all chapters
com
https://textbookfull.com/product/modern-pyqt-create-gui-
applications-for-project-management-computer-vision-and-
data-analysis-joshua-willman/
OR CLICK BUTTON
DOWNLOAD NOW
https://textbookfull.com/product/beginning-pyqt-a-hands-on-approach-
to-gui-programming-willman-joshua-m/
textboxfull.com
https://textbookfull.com/product/beginning-pyqt-a-hands-on-approach-
to-gui-programming-willman-joshua-m-2/
textboxfull.com
https://textbookfull.com/product/biota-grow-2c-gather-2c-cook-loucas/
textboxfull.com
Beginning PyQt: A Hands-on Approach to GUI Programming 1st
Edition Joshua Willman
https://textbookfull.com/product/beginning-pyqt-a-hands-on-approach-
to-gui-programming-1st-edition-joshua-willman/
textboxfull.com
https://textbookfull.com/product/beginning-pyqt-a-hands-on-approach-
to-gui-programming-1st-edition-joshua-m-willman/
textboxfull.com
https://textbookfull.com/product/create-gui-applications-with-python-
qt5-pyside2-edition-martin-fitzpatrick/
textboxfull.com
https://textbookfull.com/product/create-gui-applications-with-python-
qt5-4th-edition-martin-fitzpack/
textboxfull.com
https://textbookfull.com/product/project-management-and-bim-for-
sustainable-modern-cities-mohamed-shehata/
textboxfull.com
Modern
PyQt
Create GUI Applications for Project
Management, Computer Vision,
and Data Analysis
—
Joshua Willman
Modern PyQt
Create GUI Applications for Project
Management, Computer Vision,
and Data Analysis
Joshua Willman
Modern PyQt
Joshua Willman
Hampton, VA, USA
Introduction�����������������������������������������������������������������������������������������������������������xvii
v
Table of Contents
vi
Table of Contents
vii
Table of Contents
viii
Table of Contents
Index��������������������������������������������������������������������������������������������������������������������� 307
ix
About the Author
Joshua Willman began using Python in 2015 when he
needed to build neural networks using machine learning
libraries for image classification. While building large image
datasets for his research, he needed to build a program that
would simplify the workload and labeling process, which
introduced him to PyQt. Since then, he has tried to dive into
everything that is Python.
He currently works as a Python developer, building
projects to help others learn more about coding in Python
for game development, AI, and machine learning. Recently,
he set up the site redhuli.io to explore his and others’
interests in utilizing programming for creativity.
He is also the author of Beginning PyQt: A Hands-on Approach to GUI Programming.
xi
About the Technical Reviewer
Lentin Joseph is an author, roboticist, and robotics
entrepreneur from India. He runs a robotics software
company called Qbotics Labs in Kochi, Kerala. He has 10
years of experience in the robotics domain, primarily in
Robot Operating System (ROS), OpenCV, and PCL.
He has authored several books on ROS, namely,
Learning Robotics Using Python, first and second editions;
Mastering ROS for Robotics Programming, first and second
editions; ROS Robotics Projects, first and second editions;
and Robot Operating System (ROS) for Absolute Beginners.
He has obtained his master’s in robotics and automation
from India and also worked at the Robotics Institute, CMU,
United States. He is also a TEDx speaker.
xiii
Acknowledgments
A few simple words can mean a lot to a person. They can be the little bit of hope that lets
them know everything will be okay.
I first want to thank Apress Media LLC for giving me another opportunity to write, to
learn, and to improve my creativity and skills.
To the community of Python, PyQt, and Qt programmers, thank you for your support
and assistance.
To Adrian Rosebrock at PyImageSearch, thank you for your help, words of
encouragement, and the knowledge you continue to share with others.
To Lentin Joseph, thank you for your help and support.
To Rita Fernando, thank you for your insight and help.
To Divya Modi, I am not even sure if words are enough to express how grateful I am
for your patience. I owe you my deepest debt of gratitude.
To Christine Nieuwoudt, Callum Butler, and Giulio Mazzella, thank you for being the
friends I needed so much while away from home.
To Andrea Cotman, Aaron Rountree, Vinita Acklin, and Malik Ranger, thank you for
being the friends I need who make me miss home.
To my mother, Valorie Payne, thank you for your love and support and always being
there when I need you.
To my sisters, Jazzmin and Teesha Payne, and my brother, Jason Willman, I love and
miss all of you. P.S. Teesha, thank you for your help while writing this book.
To my wife, Lijing Ye (叶丽晶), once again I have to thank you for supporting me
while I disappeared to write. I know it wasn’t easy, and I thank you for always being
supportive. <3
To my daughter, Kalani, thank you for running up to hug me when I came home in
the evening. It means the world to me.
To everyone who picks up this book, thank you for reading, programming, and
continuing to learn. Without you, this wouldn’t be possible.
xv
Introduction
When setting out to write this book, I didn’t realize that data was the underlying theme
the whole time. In everything we do now, data can be extracted. Our habits can be
analyzed and models created to improve the ways in which we live. Data can be used
to train and teach intelligent computer systems to think and make predictions. As we
continue to add to the heaps of data that already exist, our understanding of the world
continues to grow.
We understand what data is – a collection of numbers, names, words, and other types
of information. Data can either be organized or jumbled and left up to us to clean and
discern any meaning. The question this book aims to answer is how do we access and
manipulate the information hidden within. That is the beauty of PyQt and graphical user
interfaces (GUIs). We can create any application that visualizes and works with various
kinds of data, including text, images, video, audio, or anything else. With PyQt, you can
also easily leverage the power of existing Python modules in your applications.
That is what this book focuses on, showing you how to get started creating the
different tools you need to interact with the data you collect. In Modern PyQt, we will
begin to take a look at some of the ideas related to various fields and technologies that
are being used in business and research today. Topics related to business and project
management, data science, artificial intelligence (AI) and machine learning, computer
vision, and more are introduced.
PyQt is an amazing tool for creating desktop, mobile, and embedded applications.
Modern PyQt focuses on creating desktop applications for Mac, Windows, and Linux
platforms. There are so many modules and classes to cover that it is impossible to cram
them all into a single text. This guide aims to create a foundation for getting you started
in building your own GUI applications.
xvii
Introduction
applications and for programmers who have experience using other toolkits, such
as Tkinter or wxPython, and the concepts they have learned can be carried over for
developing applications with PyQt.
A
bout the Code
Each chapter contains example programs, projects, or both. Examples are designed to
introduce each chapter’s programming concepts. Projects will work toward creating
either a complete application or the foundation for a program that you can modify and
improve by adding your own features.
There are a few occasions when you will come across mathematical formulas.
Variables representing vectors and matrices are set in boldface to follow typographical
conventions.
xviii
Introduction
Installer (pip) is used. pip installs packages from the Python Package Index (PyPI).
This method will be followed unless otherwise stated in the text. If you prefer a different
method, there are tons of tutorials on the Internet to assist you.
pip should already come with Python, but if you find that you don’t have pip
installed on your computer, information about installing the package manager for your
specific platform can be found at https://pip.pypa.io/en/stable/. More information
about installing pip for Linux can also be found in the documentation.
One final thing to note is that this text installs packages using pip3 instead of pip.
With Python 2 recently no longer supported, pip3 is only used to ensure that the Python
3 environment is being used. You can still use pip instead of pip3.
xix
Introduction
R
eader Feedback
Your feedback, questions, and comments are very important. If you would like to take
a moment to let me know your thoughts about the book or ask any questions you may
have, you can send comments to the following address: redhuli.comments@gmail.com.
You can also follow me on Twitter at https://twitter.com/RedHuli.
xx
CHAPTER 1
Overview of PyQt5
Hello! Welcome to Modern PyQt! When you build an application, whether for desktop,
mobile, or embedded devices, your goal is to create a seamless experience for the user. If
you are designing a program for others to use, then you should always consider how the
user might interact with the software to solve their problems. Applications such as web
browsers, word processors, and video players are all created to enrich the end user’s life,
helping them achieve some task simply and efficiently.
Some programs are designed to perform a minimal number of tasks, such as the
clock on your computer. Others bundle together a multitude of features that allow
people to interact with machines in unique ways. An example of this is photo editing
software. What these applications generally have in common is some kind of user
interface (UI), a visual window into the happenings in human–machine interactions,
providing feedback to the user and assisting in the human’s decision-making process.
We still continue to use command-line interfaces to interact with our computers.
However, humans have naturally steered more and more to UIs that use visual controls
rather than textual prompts. These types of UIs, known as graphical user interfaces
(GUIs), utilize a computer’s graphical capabilities to create visual windows, menus,
and other elements for a user to interact with computers. Good GUI design blends
these visual components with intuitive design to improve functionality and a user’s
experience.
In Modern PyQt, we will focus on building GUI desktop applications with the Python
programming language and the PyQt toolkit. Recent years have seen an increase in the
number of both skilled and novice programmers using Python. Its uses are widespread,
being employed in general programming, web development, data science, machine
learning, game development, and more. So it’s no wonder that Python also includes
libraries for UI development.
1
© Joshua Willman 2021
J. Willman, Modern PyQt, https://doi.org/10.1007/978-1-4842-6603-8_1
Chapter 1 Overview of PyQt5
• Pomodoro Timer
• Basic User Manager GUI
Note This text wastes no time getting into building GUIs. Hopefully, you have
some prior experience with Python and have built user interfaces with PyQt or have
used some other UI development toolkit before, such as Tkinter or wxPython. While
the chapter is an overview of PyQt, this section only glosses over many of the
fundamental topics necessary for getting started with PyQt and building UIs. Take
a moment to review the fundamentals of PyQt if it is needed. Subsequent chapters
and topics will be handled at a much slower pace.
What Is PyQt?
With the PyQt framework, you have tools at your disposal for building UIs that can work
with SQL databases, 2D and 3D graphics, network communication, multimedia, and so
much more.
However, PyQt is in fact a set of Python bindings that make it possible to use The Qt
Company’s Qt application framework. The cross-platform C++ development toolkit, Qt,
actually contains everything you need for building applications on Windows, MacOS,
Linux, Android, and embedded systems.
This means that by combining Python with Qt, you get the advantages of the C++
toolkit for making applications, such as the collection of GUI widgets and the ease of
creating flexible UIs and reusable software elements, along with the simplicity and large
collection of modules that already exist with Python. PyQt is like the glue holding them
both together.
At the time of publication, the latest version of PyQt5 is version 5.15. PyQt4 also
exists, but as of this writing, no more releases will be made for version 4.
2
Chapter 1 Overview of PyQt5
Note PyQt contains many of Qt’s classes. However, there are some examples
when a class does not exist in the PyQt library. One notable example is the Qt QList
class. PyQt does not contain this class and rather takes full advantage of the list
data structure in Python.
I nstalling PyQt5
Before you install PyQt, take a moment to ensure that Python v3.5 or higher is already
installed on your computer. The easiest way to check your version of Python is to enter the
following command into the command line for Windows or terminal for MacOS or Linux:
$ python --version
If you find that your version needs to be updated or that you don’t have Python, the
simplest way to get the latest version is to go to https://python.org/downloads/ and
find the installer for your OS.
Like Python, there are also a few ways to download PyQt5. PyQt has both a General
Public License (GPL) and a commercial version. For this guide, we will take a look at how
to install the latest GPL version of PyQt5 with wheels and the pip package installer. Enter
the following command into your shell:
The wheel that supports both your platform and your version of Python will be
downloaded from the Python Package Index (PyPI) repository. The PyQt5 wheel already
includes the parts of Qt that you need as well as the sip module. sip is simply a tool that
connects the Qt software written in C++ to Python.
For Linux users (specifically Ubuntu), run the following command instead to install
PyQt:
3
Chapter 1 Overview of PyQt5
Note For more information about installing PyQt5, please refer to the “Introduction.”
To ensure that PyQt5 is properly installed, enter python3 into the command line to
open the Python interpreter. Then input
If there are no errors, then you are ready to start making your own UI applications.
For further information about installing PyQt5, have a look at
www.riverbankcomputing.com/static/Docs/PyQt5/installation.html.
Also, if you are ever curious to know what version of PyQt5 you have installed on
your computer, enter the following two lines into the Python shell:
Finally, if you want to find out the path to PyQt on your system or see a list of the
PyQt5 modules you have installed, use the Python help() function:
After you get PyQt5 installed, you are ready to move on to this chapter’s first
application – the Pomodoro Timer.
1
ore information about the Pomodoro Technique can be found at https://francescocirillo.
M
com/pages/pomodoro-technique.
4
Chapter 1 Overview of PyQt5
A tomato-shaped kitchen timer was originally used by Cirillo. Rather than tackling an
assignment head-on for hours, this technique breaks the tasks into intervals, typically 25
minutes long (or one pomodoro). Each session of working is broken up by a short period
of rest.
The typical process of the Pomodoro Technique consists of the following six steps:
Figure 1-1. The Pomodoro Timer GUI displaying the different tabs, Pomodoro,
Short Break, and Long Break. The QLCDNumber widget displays the current tab’s
remaining time. The bottom of the GUI also gives the user a field for inputting their
current task and recording the number of pomodoro cycles
5
Chapter 1 Overview of PyQt5
This project will introduce a number of the primary tools and concepts you will need
to create your own GUIs with Python and PyQt. The Pomodoro Timer GUI demonstrates
the following concepts:
• How to use PyQt modules and widget classes for creating graphical
user interfaces
Note The first program in this chapter is a long one, but don’t get discouraged.
The hope is that you will continue following along and find out what this
application has to offer. By building this program yourself, you will be introduced to
some new ideas for creating your own GUIs.
In the following section, we will break apart the different widgets that comprise the
interface, discuss the layout, take a look at the code in Listing 1-1, and talk about the
logic behind the application.
6
Chapter 1 Overview of PyQt5
current timer using the QPushButtons. After the user clicks the Start button, it is disabled
until either Stop or Reset is clicked. When a user switches to a different tab, that tab’s
settings and widgets are reset.
The upper portion of the GUI that contains the tabs, timers, and buttons is separate
from the lower portion, where the user can input their current task and see how many
pomodoros they have completed. If four cycles are completed, a message will be
displayed in the task bar urging the user to take a longer break. The widgets for each
section are grouped together using container widgets and then organized using various
layout managers.
All of these points and more will be broken down in the “Explanation” section.
The design for the application created in Listing 1-1 was influenced by some of the
different Pomodoro Timers that can be found on the Internet.
# pomodoro.py
# Import necessary modules
import sys
from PyQt5.QtWidgets import (QApplication, QWidget, QLCDNumber,
QPushButton, QLabel, QLineEdit, QGroupBox, QTabWidget, QVBoxLayout,
QHBoxLayout)
from PyQt5.QtCore import Qt, QTimer
from PyQt5.QtGui import QIcon
from PomodoroStyleSheet import style_sheet
class PomodoroTimer(QWidget):
7
Chapter 1 Overview of PyQt5
def initializeUI(self):
"""Initialize the window and display its contents to the screen."""
self.setMinimumSize(500, 400)
self.setWindowTitle("1.1 - Pomodoro Timer")
self.setWindowIcon(QIcon("images/tomato.png"))
self.pomodoro_limit = POMODORO_TIME
self.short_break_limit = SHORT_BREAK_TIME
self.long_break_limit = LONG_BREAK_TIME
self.setupTabsAndWidgets()
self.show()
def setupTabsAndWidgets(self):
"""Set up the tab bar for the different pomodoro stages: pomodoro,
short break, long break."""
# Create the tab bar and the QWidgets (containers) for each tab
self.tab_bar = QTabWidget(self)
8
Chapter 1 Overview of PyQt5
self.pomodoro_tab = QWidget()
self.pomodoro_tab.setObjectName("Pomodoro")
self.short_break_tab = QWidget()
self.short_break_tab.setObjectName("ShortBreak")
self.long_break_tab = QWidget()
self.long_break_tab.setObjectName("LongBreak")
self.tab_bar.addTab(self.pomodoro_tab, "Pomodoro")
self.tab_bar.addTab(self.short_break_tab, "Short Break")
self.tab_bar.addTab(self.long_break_tab, "Long Break")
self.tab_bar.currentChanged.connect(self.tabsSwitched)
# Call the functions that contain the widgets for each tab
self.pomodoroTab()
self.shortBreakTab()
self.longBreakTab()
# Create the line edit and button widgets and layout for Pomodoro
Taskbar
self.enter_task_lineedit = QLineEdit()
self.enter_task_lineedit.setClearButtonEnabled(True)
self.enter_task_lineedit.setPlaceholderText("Enter Your Current Task")
task_entry_h_box = QHBoxLayout()
task_entry_h_box.addWidget(self.enter_task_lineedit)
task_entry_h_box.addWidget(confirm_task_button)
self.tasks_v_box = QVBoxLayout()
task_v_box = QVBoxLayout()
task_v_box.addLayout(task_entry_h_box)
task_v_box.addLayout(self.tasks_v_box)
9
Chapter 1 Overview of PyQt5
def pomodoroTab(self):
"""Set up the Pomodoro tab, widgets and layout."""
# Convert starting time to display on timer
start_time = self.calculateDisplayTime(self.pomodoro_limit)
self.pomodoro_lcd = QLCDNumber()
self.pomodoro_lcd.setObjectName("PomodoroLCD")
self.pomodoro_lcd.setSegmentStyle(QLCDNumber.Filled)
self.pomodoro_lcd.display(start_time)
self.pomodoro_start_button = QPushButton("Start")
self.pomodoro_start_button.clicked.connect(self.startCountDown)
self.pomodoro_stop_button = QPushButton("Stop")
self.pomodoro_stop_button.clicked.connect(self.stopCountDown)
self.pomodoro_reset_button = QPushButton("Reset")
self.pomodoro_reset_button.clicked.connect(self.resetCountDown)
10
Chapter 1 Overview of PyQt5
def shortBreakTab(self):
"""Set up the short break tab, widgets and layout."""
# Convert starting time to display on timer
start_time = self.calculateDisplayTime(self.short_break_limit)
self.short_break_lcd = QLCDNumber()
self.short_break_lcd.setObjectName("ShortLCD")
self.short_break_lcd.setSegmentStyle(QLCDNumber.Filled)
self.short_break_lcd.display(start_time)
self.short_start_button = QPushButton("Start")
self.short_start_button.clicked.connect(self.startCountDown)
self.short_stop_button = QPushButton("Stop")
self.short_stop_button.clicked.connect(self.stopCountDown)
self.short_reset_button = QPushButton("Reset")
self.short_reset_button.clicked.connect(self.resetCountDown)
# Create and set layout for the short break tab
v_box = QVBoxLayout()
v_box.addWidget(self.short_break_lcd)
v_box.addLayout(button_h_box)
self.short_break_tab.setLayout(v_box)
def longBreakTab(self):
"""Set up the long break tab, widgets and layout."""
# Convert starting time to display on timer
start_time = self.calculateDisplayTime(self.long_break_limit)
self.long_break_lcd = QLCDNumber()
self.long_break_lcd.setObjectName("LongLCD")
self.long_break_lcd.setSegmentStyle(QLCDNumber.Filled)
self.long_break_lcd.display(start_time)
11
Chapter 1 Overview of PyQt5
self.long_start_button = QPushButton("Start")
self.long_start_button.clicked.connect(self.startCountDown)
self.long_stop_button = QPushButton("Stop")
self.long_stop_button.clicked.connect(self.stopCountDown)
self.long_reset_button = QPushButton("Reset")
self.long_reset_button.clicked.connect(self.resetCountDown)
# Create and set layout for the long break tab
v_box = QVBoxLayout()
v_box.addWidget(self.long_break_lcd)
v_box.addLayout(button_h_box)
self.long_break_tab.setLayout(v_box)
def startCountDown(self):
"""Starts the timer. If the current tab's time is 00:00, reset the
time if user pushes the start button."""
self.current_start_button.setEnabled(False)
remaining_time = self.calculateDisplayTime(self.current_time_limit)
if remaining_time == "00:00":
self.resetCountDown()
self.timer.start(1000)
else:
self.timer.start(1000)
12
Chapter 1 Overview of PyQt5
def stopCountDown(self):
"""If the timer is already running, then stop the timer."""
if self.timer.isActive() != False:
self.timer.stop()
self.current_start_button.setEnabled(True)
def resetCountDown(self):
"""Resets the time for the current tab when the reset button is
selected."""
self.stopCountDown() # Stop countdown if timer is running
self.current_lcd.display(reset_time)
def updateTimer(self):
"""Updates the timer and the current QLCDNumber widget. Also,
update the task counter if a task is set."""
remaining_time = self.calculateDisplayTime(self.current_time_limit)
13
Another Random Scribd Document
with Unrelated Content
Midőn Pistától elvált, utolsó harczát küzdötte végig, arczát
megmelegíté a nagylelkűség, – legyőzte gőgjét, megismerte, hogy
ámbár Pista sem bátrabb, de szive nemesebb, – s ezen pillanattól
nem kivánt az emberek közt élni, hogy közönséges gyarlóságot
lásson, s e dibdáb népnek lábainál annyi legyen, mint a forgács, mit
vagy megtipornak, vagy odább löknek.
Kiment az erdőnek mélyébe, s néha födetlen fővel állt meg a
viharban, jól esett neki, mikor a szél összekóczolá, s ilyenkor
felnézett a százados tölgyre, melynek gyengébb ágait tépi meg a
vihar, maga pedig rendületlenül áll.
Télben a kályha szájánál ült, fütötte a kályhát, s az izzó parázsok
közé tekintve, agyában lerajzolá magát a harczos élet zaja, a
pattogó fának egyhangú zörejében a puskaropogás s olykor egy
hatalmas csattanásban kiegészítve lőn az ágyú, s még így
gondolatban is jól esett neki, hogy annyiszor röpült ő Pistával legelől,
s minő hátra marad el tőle a többi!
Történetünk idejében még a vad is szivesen húzódott volna el
valami sürűbe, ha az éhség ki nem veri szegény párát eledel után,
miért a rengetegeket igen gyakran messzire kellett összeszaladgálni;
mert tél és kegyetlen hideg volt, s a hótömeg ölnyire feküdt a föld
rétege fölött.
Alig törték meg az utat, már ismét behordta a szél, s a
«Kenyeretlen» csárda előtt hamarabb megállt a kocsi, mint máskor,
s a mi kis szénát összekotort nyáron a gazda, a beszorult emberek
mind elrimánkodták, hogy megkínzott barmaik valamikép éhen ne
veszszenek.
Pista volt a legutolsó vendég és látván, hogy a csárdában a
tüzelő-szalma is kifogyott, megigérte a szabadosnak, hogy másnap
estig legfölebb, megjön egy forduló szalmával, s azonkívül a
megfogyott élelmet megint kipótolja.
Néhány órával később az éjszaki szél ujabb vihart hozott, s nem
maradt embernyom az úton, csak a széles erdőnyilás vezette az
embert, ha ezen órában még az úton maradt volna, melyen a vadak
is eszeveszetten rohantak, mert vagy a vihar, vagy az éhség
kergethette őket.
A szabados hanyatlani érzé az erőt, sebeit elevenné tette a
kemény idő, melynek mérgétől nem kimélte magát, s néha órákig
elácsorgott a csárda előtt, vagy még messzebb is, ha tán valamely
megszorult utast a viharok künn szorítottak volna, – és Pista nagyon
észrevette, hogy a szabados önmagával birkózik, midőn
szenvedéseit tagadja, tehát föltette magában, hogy másnap
visszajön, nehogy inségben feledje az erdőn.
Fáradtan húzkodott be a konyhára néhány darab fát, mit előbb
vagdalt össze, – nehogy tűz nélkül maradjon, mert az utolsó szál
szalmát Pistának lovai ették meg, s míg az Keszthelyről megfordul,
ilyen zivatarban akár meg is fagyhat.
Alig veté le az utolsó fadarabot, s alig helyezkedék el egy
bundán, kegyetlen fájások rohanták meg, s majdnem elfásultan
hevert ott néhány óráig; – midőn pedig megszünvén a fájdalom, az
álom is lefogta szemét, a kályhában a parázs lassankint elhamvadt,
s mire fölébredt, már a hamu is megfázott.
Van-e valaki eleven ember ebben a házban? – szól egy ember,
kinek bajusza, szakálla jégcsappá dermedt, s mint egy csoda nézett
be a konyhaajtón.
– Itt vagyok! – mondja a szabados, fölkapaszkodván nagy kínnal,
hogy a betévedt embernek segéljen, ha tán segítségre lenne
szükség.
Az ajtó nyilásán át látta a gazda, hogy egy szánra rakott hintó áll
a félszer alatt, – előtte négy ló gőzölögve várja az enyhelyet, a
hintóból pedig két úrhölgyet segít ki egy úr és karjára fogva vezeti
őket az egykori borivóba.
– Irgalmas Isten, csakhogy megmenekülhettünk; – mondja az
idősebb hölgy, kiről a szépség virágai nem szálltak el, ámbár az
ifjabb hölgy gyermeke, de a két hölgy között alig van több különbség,
mint egy ágnak két virága közt, melyek közől az egyik a nyilott virág
egész pompájában, a másik pedig a most fakadó bimbó.
Utasaink gróf Dunay nejével és leányával, kik az egyezségre
indulának s a zivatar az útban kapta őket s ha a csárdához nem
érnek, a fáradt lovak már az úton összerogynak.
– Anyám, – édes szép anyám! – mondja a gyermeteg hölgy,
anyját átölelve, – már azt hittem, hogy az út közepén fagyunk meg
valamennyien.
A szabados megdöbbent a szóra és sietve botorkált a konyhába,
hogy a kályhában éleszsze a tüzet, de midőn kemény ujjaival a
hamuba markolt, egészen hidegnek találta.
Tűzszerszáma után kotorászott, egyetlen kénpapir darabnál
többet nem talált, de tudta azt, hogy egy szál szalma sincsen a
csárdában, mi lángot ereszszen a fa alá, hogy tüzet fogjon, aggódva
kérdé a bejövő kocsistól:
– Jó barátom, nincs széna a bakon?
– Csakhogy magunk ide értünk, hisz utóbb már a kocsiládákat is
lecsavartam és a hóba hánytam, mert a lovak alig birták el a terhet,
hanem fél zsákra való abrakom van.
– Adja a lovaknak barátom! – mondja a szabados és egy
törzsökre hanyatlott, mert megriadt a gondolattól, hogy ennyi embert
az isten hidege vegyen meg, s az istálló sokkal tágasabb volt,
minthogy azt a négy darab ló megmelegíteni birja.
Dunay kijött a szobából, hihetőleg megérezte a melegnek fogytát,
s azt mondja a gazdának:
– Van-e fája, édes jó barátom?
– Az erdőnek legmélyében vagyunk uram, hisz a fára látok ki az
ajtón.
– Szokták füteni a kályhát?
– Ma reggel még ökröt is megsüthettem volna benne, de
lenyomott a fájdalom, – beszéli a szabados, – s míg később
elszunnyadtam, az alatt elhamvadt az utolsó szikra is.
– Rakunk újra tüzet – mondja a gróf.
– Nem vártam volna a parancsolást uram; de nincs mit elgyújtani.
– Hisz akkor megfagyunk! – véli a gróf rémülten.
– Nekem jótétemény lenne uram; de szánom ott benn azt a két
ártatlan cselédet.
– Barátom!… mondja a gróf megriadva… ez igazság vagy tréfa?
– Uram, már mondám, hogy azokat sajnálom ott benn; mert hisz
mi férfiak nem ijedünk meg a haláltól, akár ma érjen el, akár holnap
– fejezi be a szabados, a kénpapir-szeletet forgatván kezében.
– Barátom, – mondja a gróf, – egy könnyű kendő meggyúl még
ettől!
– Nem hiszem, – okoskodik amaz, – alig akkora a papir, hogy a
ként rámázolhatták, – azonban próbáljuk meg, ha meg nem gyúl, –
megfagyni akkor is ráérünk.
A gróf beszaladt, de a téli ruhák között nem akadt egy darab,
mely használhatott volna, azért mielőtt a nőknek szólna, újra kiment
a konyhára, hogy finom ingét próbálja meg letépni, tán az megfogja
majd a lángot.
A szabados kiment a csárda elejére, hogyha tán elszóródott
valahol néhány szalmaszál, azonban a hó már a házoldalon kezdett
összegyülekezni, hanem midőn az erdőnyiláson végig nézne,
három-négy puskalövésnyire lát egy elakadt hintót, s valamivel idább
négy ember törtetett egyik fától a másikig.
– Nem hittem, hogy ennyien lesznek a temetésemen! – dörmögi
a szabados, ki után a gróf kisietett, s minthogy a jövőket meglátta, a
pihentebb lovakat elővezetteté, ha még megtennék a szolgálatot, és
a hóban bukdácsolókat egyenkint elhoznák.
A kocsis az első; a gróf a hátulsó lovak egyikére kapott, s az alsó
útra gázolának szél után, s ámbár elég kínnal, de mégis elég jókor
elérték a négy gyalogoló embert.
Az ösmerkedés nem sokáig tartott, – az inség előtt a lenyujtott
kéz a legnemesebb emberbarát keze, s midőn az ember halódni
készül, utolsónak vélt órájában önként nyúl leghalálosabb ellenének
keze után s a végső végórában felebarátjait látja.
Baltayt fölsegíté a gróf a lóra, s mind a négyet átengedték a
lihegő utasoknak, a gróf pedig kocsisával a törésen ballagott, s mire
a két nő akart a gróf után tekinteni, hatan nyitottak be.
Baltay és Imre, valamint András és a kocsis volt az ujon érkezett
vendég, kik bámulva néztek egymásra a szoba közepén, de itt is
András törte meg a csöndet, levetvén hóna alól egy nagy csomót,
aztán pedig a nagyságos urat kezdé kiszedni a fagyból.
– Most már itt vagyunk valamennyien, – dörmögi András, – csak
a prókátorok hiányzanak ebben a farkasordítóban, hanem találunk
majd helyettük farkasokat.
Mindenki hallgatott, egyik sem tudta folytatni a beszédet, s
minthogy sokáig tartott a hallgatás, Dunay gróf kihívta Andrást a
konyhába.
– András! – mondja a gróf, – mi itt abban a veszedelemben
vagyunk, hogy az erdőben a fa között fagyunk meg; mert nincsen
mivel alágyujtsuk a fát.
– Itt van minden gyújtószerünk, – mondja a szabados a kis
kénpapirt előmutatva, – pedig ezzel a nyers fát tudom meg nem
gyújtjuk.
– Hála légyen a jó úristenek, – mondja András, – csakhogy itt
vagyunk.
– De megkivánta kend a halódást, atyafi, – boszankodik a
szabados, – hogy így megörült kend neki.
– De még nem kivánkozom kihordozóskodni ebből a világból,
hallja, jó barátom, – mondja András, – majd csinálok én tüzet, ha
még olyan nedves is a kelmed fája.
– Az angyalok szólnak belőle, édes öregem, – véli a gróf, –
hanem ne késsék vele, fogjon rögtön hozzá, mert már a nők nagyon
érzik a hideget.
– Csak fél órát várjunk méltóságos uram, – hadd adjam meg a
módját, – azért menjen csak be, majd én az én uraimat hívom ki.
A gróf Andrásra hagyta a dolgot, – bement a nőkhöz, kik a kályha
mellett foglaltak helyet, az öreg úr pedig Imrét akarta kiküldeni, hogy
nézzen körül a házánál, hogy meg ne fagyjanak.
András kihívta a férfiakat, kik a hívásnak engedtek, s az öreg úr
Andrástól kérdezte:
– Mi a baj, András?
– Az, hogy itt fogunk megfagyni! – mondja András egész
komolysággal nézve szemközt, s elmondván, hogy nincs mit
meggyújtani.
– Ne kiáltson kend olyan hangosan! – mondja Baltay, – hisz én is
megijedtem, hát még azok a szerencsétlen asszonyok!
– No hát elhiszi a nagyságos úr, a mit mondtam? – kérdezkedék
András.
– El hát, – mondja kínosan, – csak azt sajnálom, hogy ezek a
szegény nők itt vannak.
– Magát sajnálja a nagyságos úr, jobb lesz!
– Legyen kendnek esze a pokolban, engem már elevenen
kinyújtóztathat kend!
András nem birta könyű nélkül megállni az öreg úrnak
lemondását, kivált mikor egy hosszú hallgatás után Baltay Imrére
nézett, s annak kezét részvéttel fogta meg.
– Imre, – mondja az öreg, – remélem emberré neveltelek, hanem
ha, mint remélem, tovább kibirod, mint mi, ezt a kis lányt megőrzöd,
a mig lehet.
– Bátyám, – nem tagadom, – érette szivesen meghalok.
– Szereted?
– Nem mertem eddig megmondani! – vallja be a fiú.
– Régen vártam erre, s én nem mertelek rákényszeríteni; –
mondja az öreg is megkönnyezve a végszót, s midőn kendőjeért
nyúlna, hogy könyűjét letörülje, oldalzsebében nem lelé, hanem a
helyett Kisfaludy munkáit húzta ki, mit a kilépő gróf is meglátott már.
– Nagyságos uram, – mondja András, – még van egy szál
kéngyertyánk.
– Hát aztán!
– Nem bánná meg, ha az úrfi a kisasszonyt elvenné?
– Ne támaszsza föl kend az embert, – András! – szól
reménykedve az öreg.
– Ha azt a Kisfaludyt meggyújtom ezzel a kéngyertyával, mindjárt
lesz tüzünk.
– Nem ezt akarta kend mondani, András? – véli az öreg, – tudja
kend, hogy ez legkedvesebb jószágom.
Dunay meghatottan állt az öreg háta mögött, – s láthatta, hogy
remegnek az öregnek kezei, melyekben a könyveket tartja.
– Hát nem adja oda, nagyságos uram?
– Meggyújtaná kend az imádságos könyvét? – kérdi átható
hangon Baltay.
– Nem tudom, nagyságos uram! – mondja meglepetve a hajdú.
– Nekem ez imádságos könyvem! – bizonykolja az öreg, mire
Dunay elébe lép és először annyi idő után megszólítja az öreget.
– Most meg én faragok róvást! – mondja Dunay a multakra
czélozva, mire Baltay a gróf kezét megfogván, mondja:
– Nem fogja azt tenni, – egyszersmind Andrásnak azt mondja: –
láttam, hogy elhozta kend azt a nagy pört, – gyújtsa meg kend azt, –
de Kisfaludyt el nem pörköli kend.
– Inkább a pört, mint a könyvet? – kérdi Dunay boldogságtól
csillogó arczczal.
– Megadom magamat! – vallja be az öreg, helyet adván
Andrásnak, ki a nagy csomó papirt a kályha szájához vitte, hol az
aprófa készen volt, azután egy ütet taplóval föllobbanták a
kéngyertyát, s a kis szelet papirról a láng a pörhalmaznak egyes
csomóiba kapott, s mire egy része elégett, a nedves fát is megjárta a
láng, durrogva égvén a kályhában, melyhez a didergő vendégek egy
nagy körbe ültek.
Midőn András a tűzbe lökte a pörnek utolsó levelét, azt mondja:
– Mondtam ugy-e, nagyságos uram, hogy én vetem ezt tűzbe!
– No, hogy jobban égjen, – teszi hozzá az öreg, – itt még a rovás
is, – mondja, kihúzván oldalzsebéből a rovást, mit oly régóta
hordozgat magával, – szent a béke köztünk.
Mire bemelegedett a kályha, Baltay megösmerkedett a kis
lánynyal, kit ma ölelt meg legelőször s kezét Imréébe adván, azt
mondja:
– Édes kis hugocskám, rég neked szántam én már ezt a fiút.
– Azt gondolja a nagyságos úr, – kiált közbe András, – hogy én
azt már régen nem tudtam?
– De nem tudta kend.
– Dehogy nem tudtam, – csak hogy nem akartam mondani a
nagyságos úrnak, hogy szivesen megbékülne, – csak valaki szép
módjával elkezdeni tudná.
– Semmit sem tud kend! – mondja Baltay, nagy diadallal szedvén
elő tárczájából egy rég meggyűrt levelet, s odaadá Dunaynak, ki
rögtön megismerte a boldogult herczeg írását, melynek hiányzó
sorai következők valának:
«– – – – – – – – – –
A végóra nagy későn mondja meg, édes jó barátom, hogy rövid
életünkben is temérdek jót tehettünk volna, s higyj nekem, nagy
nyugalom tudni, hogy sokan szerettek bennünket igazán, s elfeledni
akarva sem tudnak.
Öcséd, mint Dunaytól tudom, szép lelkü gyermek – Dunaynak
leánygyermeke van, ne engedd, hogy hajlékodból idegenek tanyája
legyen, a míg lehet; – vezesd össze a két gyermeket, hogy
szeretteid úgy sirassanak meg, mint az enyéim most engemet. – Ez
első és utolsó kérelme annak, ki hű barátod a sírig Herczeg
Batthyányi Lajos m. k.»
A sorokat Dunay hangosan olvasá, a két gyermek
összefogózkodék, s a nyomorult viskóban ölelkezék össze a rég
küzködő család, mely nem lelt elég helyet a széles birtokon egy
istenáldott szóra, míg a közös veszedelem egy csárda falai közt
hozta őket össze.
András három lépésről nézte őket, mint a fáradt művész nézte
ezt a munkát, mely nélküle nem tudott megkészülni, s melyből neki
csak az az osztaléka volt, a mi becsületes embernek mindenütt jut, s
miért a gazember fáradni nem akar; – az egyiknek kevés, a
másiknak pedig az öntudat végtelen jutalom.
– András! – kiált örömében Baltay, – ha haza megyünk, minden
rovást égessen kend össze.
– Senkire sem haragszik meg ezután nagyságos úr?
– Nem én, még kendre sem! – Tréfálódzék az öreg.
– Azt hiszi nagyságos uram, hogy nem lesz még olyan magyar
ember, kinek rováson a helye?
– Azt már ezután nem mi rójuk meg, hallja kend; de a
közvélemény.
XI.
(Egyezség prókátorok nélkül.)
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com