[PyQt4] MessageBox show

#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
import sys
from PyQt4.QtGui import *
# Create an PyQT4 application object.
a = QApplication(sys.argv)      
# The QWidget widget is the base class of all user interface objects in PyQt4.
w = QWidget()
# Show a message box
result = QMessageBox.question(w, 'Message', "Do you like Python?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
if result == QMessageBox.Yes:
    print 'Yes.'
else:
    print 'No.'        
# Show window
w.show()
sys.exit(a.exec_())


댓글

  1. PyQT4 Warning Box
    You can display a warning box using this line of code:
    QMessageBox.warning(w, "Message", "Are you sure you want to continue?")
    1

    QMessageBox.warning(w, "Message", "Are you sure you want to continue?")

    답글삭제
  2. Information Box:

    QMessageBox.information(w, "Message", "An information messagebox @ pythonspot.com ")

    답글삭제

댓글 쓰기

이 블로그의 인기 게시물

파이썬으로 Homomorphic Filtering 하기

파이썬으로 2D FFT/iFFT 하기: numpy 버전