Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- from PyQt6.QtCore import Qt
- from PyQt6.QtWidgets import QApplication, QWidget, QMessageBox, QPushButton
- def tampilkanKotakPesan(self):
- kotakPesan = QMessageBox()
- kotakPesan.setWindowTitle("Kotak Pesan Pertama")
- kotakPesan.setText("Kotak Pesan Berhasil Ditampilkan")
- kotakPesan.setStandardButtons(kotakPesan.StandardButtons.Yes | kotakPesan.StandardButtons.No)
- kotakPesan.exec()
- aplikasi = QApplication(sys.argv)
- jendela = QWidget()
- jendela.resize(300,300)
- jendela.setWindowTitle("Tampilkan Dialog Box")
- # Membuat tombol
- tombol1 = QPushButton(jendela)
- tombol1.setText("Tampilkan Window Dialog")
- tombol1.move(50,50)
- # tekan tombol
- tombol1.clicked.connect(tampilkanKotakPesan)
- jendela.show()
- aplikasi.exec()
- # Menampilkan Dialog Box Yes dan No, berhasil dengan source code ini
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement