Advertisement
stevennathaniel

PyQt6 : Menampilkan Icon Information Pada QMessageBox

Feb 3rd, 2021
978
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. import mariadb
  2.  
  3. import sys
  4.  
  5. from PyQt6 import QtWidgets, QtCore, QtGui
  6.  
  7. from PyQt6.QtCore import Qt
  8.  
  9. from PyQt6.QtWidgets import QApplication, QWidget, QMessageBox, QPushButton
  10.  
  11.  
  12. def tampilkanKotakPesan():
  13.  
  14.     kotakPesan = QMessageBox()
  15.  
  16.     kotakPesan.setWindowTitle("Tampilkan Icon")
  17.  
  18.     kotakPesan.setIcon(kotakPesan.Icon.Information)
  19.  
  20.     kotakPesan.setText("Menampilkan Icon")
  21.  
  22.     kotakPesan.setStandardButtons(kotakPesan.StandardButtons.Ok)
  23.  
  24.     kotakPesan.exec()
  25.  
  26.  
  27.  
  28.  
  29. aplikasi = QApplication(sys.argv)
  30.  
  31. jendela = QWidget()
  32.  
  33. jendela.resize(300,300)
  34.  
  35. jendela.setWindowTitle("Tampilkan Dialog Box")
  36.  
  37.  
  38. # Membuat tombol
  39.  
  40. tombol1 = QPushButton(jendela)
  41.  
  42. tombol1.setText("Tampilkan Kotak Dialog")
  43.  
  44. tombol1.move(10,10)
  45.  
  46.  
  47.  
  48. tombol1.clicked.connect(tampilkanKotakPesan)
  49.  
  50. jendela.show()
  51.  
  52. aplikasi.exec()
  53.  
  54.  
  55.  
  56.  
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement