-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQPushButton.py
More file actions
39 lines (30 loc) · 947 Bytes
/
QPushButton.py
File metadata and controls
39 lines (30 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from PyQt5.QtWidgets import QApplication, QPushButton, QMainWindow
import sys
from PyQt5 import QtGui
from PyQt5.QtCore import QRect
from PyQt5 import QtCore
class Window(QMainWindow):
def __init__(self):
super().__init__()
title = "Py QT5 Button"
left = 500
top =200
width =300
height =250
iconName = "kali.jpg"
self.setWindowTitle(title
)
self.setWindowIcon(QtGui.QIcon(iconName))
self.setGeometry(left,top, width, height)
self.UiComponents()
self.show()
def UiComponents(self):
button = QPushButton("Click", self)
#button.setGeometry(QRect(100,100, 111.28))
button.setIcon(QtGui.QIcon("kali.jpg"))
button.setIconSize(QtCore.QSize(40,40))
button.setToolTip("This is a Button")
if __name__ == "__main__":
App = QApplication(sys.argv)
window = Window()
sys.exit(App.exec())