from
PyQt5.QtWidgets
import
*
from
PyQt5
import
QtCore, QtGui
from
PyQt5.QtGui
import
*
from
PyQt5.QtCore
import
*
import
sys
class
Window(QMainWindow):
def
__init__(
self
):
super
().__init__()
self
.setWindowTitle(
"Python "
)
self
.setGeometry(
100
,
100
,
500
,
400
)
self
.UiComponents()
self
.show()
def
UiComponents(
self
):
push
=
QPushButton(
"Press"
,
self
)
push.setGeometry(
100
,
100
,
120
,
40
)
label
=
QLabel(
"GeeksforGeeks"
,
self
)
label.setGeometry(
100
,
160
,
200
,
50
)
label.setAlignment(Qt.AlignCenter)
font
=
QFont(
"Arial"
,
12
)
label.setFont(font)
label.setStyleSheet(
"QLabel"
"{"
"border : 2px solid green;"
"background : lightgreen;"
"}"
)
label.hide()
push.clicked.connect(
lambda
: do_something())
def
do_something():
label.show()
App
=
QApplication(sys.argv)
App.setCursorFlashTime(
100
)
App.setObjectName(
"GfG"
)
App.setApplicationDisplayName(
"GfG PyQt5"
)
App.beep()
App.aboutQt()
window
=
Window()
sys.exit(App.
exec
())