Created
October 7, 2021 08:23
-
-
Save galihboy/0e8f02181310c2c02351c4cc93872894 to your computer and use it in GitHub Desktop.
Aplikasi PyQt pertama
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
# 1. Mengimpor library "QApplication" dan semua widget yang dibutuhkan | |
from PyQt5.QtWidgets import QApplication | |
from PyQt5.QtWidgets import QLabel | |
from PyQt5.QtWidgets import QWidget | |
# 2. Buat instan dari QApplication | |
app = QApplication(sys.argv) | |
# 3. Buat instan aplikasi GUI | |
jendela = QWidget() | |
jendela.setWindowTitle('Aplikasi PyQt') | |
# setGeometry = A,B,C,D | |
# A = posisi margin kiri, B = margin atas, C = lebar jendela, D = tinggi jendela | |
jendela.setGeometry(500, 200, 250, 70) | |
pesan = QLabel('<h1>Assalaamu\'alaikum</h1> Galih, apa kabar?', parent=jendela) | |
# 4. Tampilkan aplikasi GUI | |
jendela.show() | |
# 5. Jalankan perulangan aktivitas utama atau event tertentu | |
sys.exit(app.exec_()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment