Skip to content

Instantly share code, notes, and snippets.

@galihboy
Created October 7, 2021 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save galihboy/0e8f02181310c2c02351c4cc93872894 to your computer and use it in GitHub Desktop.
Save galihboy/0e8f02181310c2c02351c4cc93872894 to your computer and use it in GitHub Desktop.
Aplikasi PyQt pertama
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