# -*- 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()

如图:

pyqt 自定义例子学习的更多相关文章

  1. pyqt QTreeWidget例子学习

    # -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import  * from Py ...

  2. pyqt columnView例子学习

    # -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import  * from Py ...

  3. pyqt QTableView例子学习

    # -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import  * from Py ...

  4. pyqt QTableWidget例子学习(重点)

    # -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from PyQ ...

  5. pyqt 托盘例子学习

    # -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from PyQ ...

  6. pyqt 正则表达式例子学习

    def rex01(self): username=QtCore.QRegExp('[a-zA-Z0-9_]{2,10}') self.names.setValidator(QtGui.QRegExp ...

  7. pyqt tabWidget例子学习1

    from PyQt4 import QtGui from PyQt4 import QtCore from PyQt4.QtCore import pyqtSlot,SIGNAL,SLOT impor ...

  8. pyqt 配置文件例子学习

    # -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' import sys,datetime from PyQt4.QtC ...

  9. PyQt(Python+Qt)学习随笔:Designer中的QDialogButtonBox增加自定义按钮的方法

    在Qt Designer中可以预先定义标准按钮,相关支持的标准按钮请见<PyQt(Python+Qt)学习随笔:Designer中的QDialogButtonBox的StandardButton ...

随机推荐

  1. 5分钟精通git教程

    git是一个版本控制工具,就要先弄清楚什么是版本 版本: 对外发布的版本如v1.0.0,v1.1.0 叫version 内部代码的版本叫commit,如:修改了一个错别字 顾名思义一个version就 ...

  2. [置顶] cJSON库(构建json与解析json字符串)-c语言

     一.c语言获取json中的数据. 1.先要有cJOSN库,两个文件分别是cJSON.c和cJSON.h. 2.感性认识 char * json = "{ \"json\" ...

  3. [TypeScript] Avoid any type

    To avoid using "any" type is a best pratice. The reason for that is it disable the power o ...

  4. Picasso – Android系统的图片下载和缓存类库

    Picasso – Android系统的图片下载和缓存类库 Picasso 是Square开源的一个用于Android系统下载和缓存图片的项目.该项目和其他一些下载图片项目的主要区别之一是:使用4.0 ...

  5. CATransform3D中m34字段的取值含义

    转载自:http://zhidao.baidu.com/link?url=OlVQoGOKIBmaXKgQisOLtzliTLPvreOOsRmny3yebA1Wb6-B3KtuKlRXmv0tO3y ...

  6. UIActivityIndicatorView活动控制器的大小改变

    self.activityView = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicat ...

  7. ios--图片处理(修改、保存)UIGraphicsBeginImageContext

    http://www.th7.cn/Program/IOS/201407/250904.shtml

  8. TelerikUI_RadGrid_Filter 自定义方法

    要设置 EnableLinqExpressions="false",搞了3,4个小时没反应,就是没有设置这个 Protected Sub btnSearch_Click(sende ...

  9. [翻译] C++ STL容器参考手册 (总册)

    1. 写在最前面 这将是博主的第一篇技术博客,思考再三决定从翻译开始.这将是一个系列的博客,由不同的章节组成,章节之间由超链接联系,开发过程将使用增量式开发,每次完成一个章节.本篇是本系列的总册,提供 ...

  10. iscroll-lite.js源码注释

    /*! iScroll v5.1.2 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */ (function (window, ...