from
PyQt5.QtWidgets
import
*
from
PyQt5
import
QtCore, QtGui
from
PyQt5.QtGui
import
*
from
PyQt5.QtCore
import
*
import
sys
class
ScrollLabel(QScrollArea):
def
__init__(
self
,
*
args,
*
*
kwargs):
QScrollArea.__init__(
self
,
*
args,
*
*
kwargs)
self
.setWidgetResizable(
True
)
content
=
QWidget(
self
)
self
.setWidget(content)
lay
=
QVBoxLayout(content)
self
.label
=
QLabel(content)
self
.label.setAlignment(Qt.AlignLeft | Qt.AlignTop)
self
.label.setWordWrap(
True
)
lay.addWidget(
self
.label)
def
setText(
self
, text):
self
.label.setText(text)
class
Window(QMainWindow):
def
__init__(
self
):
super
().__init__()
self
.setWindowTitle(
"Python "
)
self
.setGeometry(
100
,
100
,
600
,
400
)
self
.UiComponents()
self
.show()
def
UiComponents(
self
):
text
=
"There are so many options provided by Python to develop GUI "
\
"application and PyQt5 is one of them. PyQt5 is cross-platform "
\
"GUI toolkit, a set of python bindings for Qt v5. One can develop"
\
" an interactive desktop application with so much ease because "
\
"of the tools and simplicity provided by this library.A GUI application"
\
" consists of Front-end and Back-end. PyQt5 has provided a tool called "
\
"‘QtDesigner’ to design the front-end by drag and drop method so that "
\
"development can become faster and one can give more time on back-end stuff. "
label
=
ScrollLabel(
self
)
label.setText(text)
label.setGeometry(
100
,
100
,
200
,
80
)
App
=
QApplication(sys.argv)
window
=
Window()
window.show()
sys.exit(App.
exec
())