37,718
社区成员
发帖
与我相关
我的任务
分享
# mysetup.py
from distutils.core import setup
import py2exe
setup(console=["helloworld.py"])
#/usr/bin/python
import os
print 'hello'
os.system('pause')
# mysetup.py
from distutils.core import setup
import py2exe
setup(windows=["messagebox.py"])
#!/usr/bin/python
# messagebox.py
import sys
from PyQt4 import QtGui
class MessageBox(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setGeometry(300, 300, 250, 150)
self.setWindowTitle('message box')
def closeEvent(self, event):
reply = QtGui.QMessageBox.question(self, 'Message',
"Are you sure to quit?", QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
event.accept()
else:
event.ignore()
app = QtGui.QApplication(sys.argv)
qb = MessageBox()
qb.show()
sys.exit(app.exec_())
print 'hello'
raw_input()