# -*- coding: utf-8 -*-
# python:2.x
__author__ = 'Administrator'
import sys
from PyQt4.QtCore import Qt
from PyQt4 import QtGui,QtCore,Qt
from about import Ui_Form
class Example(QtGui.QDialog,Ui_Form):
def __init__(self,parnet=None):
super(Example, self).__init__(parnet)
self.setupUi(self)
self.pushButton.clicked.connect(self.about1)
self.pushButton_2.clicked.connect(self.about2)
def about2(self):
url=QtGui.QLabel(u'<a href=http://weibo.com/fangjiayu1107/home?wvr=5&lf=reg>微博在线</a>',self)
abot_1=QtGui.QMessageBox(self)
abot_1.setWindowTitle(u'关于本工具及作者')
abot_1.setText(u'本工具是由pyqt4软件进行制件的一款菜鸟级别的播放器。\n'
u'是bug大菜鸟所制作。\n\t'
u'\t在制作当中经常修改,\n'
u'在这先谢谢大家支持本工具了,\n'
u'%s'%(url.linkActivated.connect(self.openurl))
)
icon=QtGui.QPixmap('a.jpg')
abot_1.setIconPixmap(icon)
abot_1.show()
def openurl(self,url):
QtGui.QDesktopServices.openUrl(QtCore.QUrl(unicode(url)))
def about1(self):
abc=QtGui.QMessageBox(self)
abc.setWindowTitle(u'提示')
abc.setIconPixmap(QtGui.QPixmap('a.jpg'))
Yes=abc.addButton(u'是的',QtGui.QMessageBox.ActionRole)
abc.setText(u'自定义')
abc.exec_()
button=abc.clickedButton()
if button==Yes:
print 'ok'
self.close()
def main():
app = QtGui.QApplication(sys.argv)
ex = Example()
ex.show()
sys.exit(app.exec_())
main()
如图: