首页 > 代码库 > 平时的笔记01
平时的笔记01
# -*- coding: cp936 -*-
from PyQt4 import QtGui,QtCore
import sys
class MianWindow(QtGui.QMainWindow):
def __init__(self,parent=None):
QtGui.QMainWindow.__init__(self)
self.resize(350,250)
self.setWindowTitle(‘mainwindow‘)
textEdit=QtGui.QTextEdit()
self.setCentralWidget(textEdit)
exit=QtGui.QAction(QtGui.QIcon(r‘F:\qt1\images\100.png‘),‘Exit‘,self)
exit.setShortcut(‘Ctrl+Q‘)
exit.setStatusTip(‘Eixt application‘)
self.connect(exit,QtCore.SIGNAL(‘triggered()‘),
QtGui.qApp,
QtCore.SLOT(‘quit()‘))
self.statusBar()
menubar=self.menuBar()
file=menubar.addMenu(‘&File‘)
file.addAction(exit)
toolbar=self.addToolBar(‘Exit‘)
toolbar.addAction(exit)
app=QtGui.QApplication(sys.argv)
main=MianWindow()
main.show()
sys.exit(app.exec_())