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.setWordWrap(
True
)
lay.addWidget(
self
.label)
def
setText(
self
, text):
self
.label.setText(text)
def
text(
self
):
get_text
=
self
.label.text()
return
get_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 " \
" There are so many options provided by Python to develop GUI" \
" There are so many options provided by Python to develop GUI"
label
=
ScrollLabel(
self
)
label.setText(text)
label.setGeometry(
100
,
100
,
150
,
80
)
label.setToolTip("It
is
tool tip")
label.setToolTipDuration(
1000
)
App
=
QApplication(sys.argv)
window
=
Window()
sys.exit(App.
exec
())