Skip to content

Commit 60bba36

Browse files
committed
Creating your first app with PyQt5
1 parent 17fd8ef commit 60bba36

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import sys
2+
3+
from PyQt5.QtCore import QSize
4+
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
5+
6+
7+
class MainWindow(QMainWindow):
8+
def __init__(self):
9+
super().__init__()
10+
11+
self.setWindowTitle("My App")
12+
13+
button = QPushButton("Press Me!")
14+
15+
self.setFixedSize(QSize(400, 300))
16+
17+
self.setCentralWidget(button)
18+
19+
20+
app = QApplication(sys.argv)
21+
window = MainWindow()
22+
window.show()
23+
app.exec()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import sys
2+
3+
from PyQt5.QtWidgets import QApplication, QWidget
4+
5+
app = QApplication(sys.argv)
6+
window = QWidget()
7+
window.show()
8+
app.exec()

0 commit comments

Comments
 (0)