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():
- kotakPesan = QMessageBox()
- kotakPesan.setWindowTitle("Kotak Pesan Kedua")
- kotakPesan.setText("Kotak Pesan Berhasil Ditampilkan")
- kotakPesan.setStandardButtons(kotakPesan.StandardButtons.Yes | kotakPesan.StandardButtons.No)
- x = kotakPesan.exec()
- if x == 16384:print("Tombol Yes telah di klik")
- if x == 65536:print("Tombol No telah di klik")
- 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()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement