# -*- coding:utf-8 -*-
#!/usr/bin/python
#=====================================
#FUNC:xuexie learn about close window
#学习对字体的设置
#date:140320
#=====================================
__author__ = 'jjw'
import sys
from PyQt4 import QtGui
from PyQt4 import QtCore
class QuitButton(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setGeometry(300, 300, 400,250)
self.setWindowTitle("quitbutton")
#QtGui.QWidget.setFont(self.setWindowTitle("quitbutton"), 16)
quit = QtGui.QPushButton(self.to_chinese("关闭"), self)
quit.setGeometry(10, 10, 100, 60)
quit.setFont(QtGui.QFont("OldEnglish", 24))
self.connect(quit, QtCore.SIGNAL("clicked()"), QtGui.qApp,
QtCore.SLOT("quit()"))
#这里是就是将英文转化为中文的函数
def to_chinese(self,thestr_to_chinese):
self.to_chinesestr = thestr_to_chinese
the_returnstr = unicode(self.to_chinesestr, "utf-8")
return the_returnstr
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
quit_1 = QuitButton()
quit_1.show()
sys.exit(app.exec_())
阅读(3684) | 评论(0) | 转发(0) |