pyqt 自定义例子学习
# -*- 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 自定义例子学习的更多相关文章
- pyqt QTreeWidget例子学习
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from Py ...
- pyqt columnView例子学习
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from Py ...
- pyqt QTableView例子学习
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from Py ...
- pyqt QTableWidget例子学习(重点)
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from PyQ ...
- pyqt 托盘例子学习
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from PyQ ...
- pyqt 正则表达式例子学习
def rex01(self): username=QtCore.QRegExp('[a-zA-Z0-9_]{2,10}') self.names.setValidator(QtGui.QRegExp ...
- pyqt tabWidget例子学习1
from PyQt4 import QtGui from PyQt4 import QtCore from PyQt4.QtCore import pyqtSlot,SIGNAL,SLOT impor ...
- pyqt 配置文件例子学习
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' import sys,datetime from PyQt4.QtC ...
- PyQt(Python+Qt)学习随笔:Designer中的QDialogButtonBox增加自定义按钮的方法
在Qt Designer中可以预先定义标准按钮,相关支持的标准按钮请见<PyQt(Python+Qt)学习随笔:Designer中的QDialogButtonBox的StandardButton ...
随机推荐
- Spark Accumulators
概述 Accumulator即累加器,与Mapreduce counter的应用场景差不多,都能很好地观察task在运行期间的数据变化,Spark中的Accumulator各task可以对Accumu ...
- Cocos2d-x学习笔记(3)
Cocos2d-x有一个包括全部其它头文件的cocos2d.h,仅仅要在使用时包括这个头文件,就能够使用引擎的全部功能.Cocos2d-x的类都放置于cocos2d的命名空间下,如引擎下的" ...
- 为人们服务的asp.net 验证控件
ASP.NET是微软推出的WEB开发工具,他有很强大的功能,今天看视频讲到验证控件这一部分,真的感受到了微软全心全意为人民服务了.越来越佩服微软了,人家都设计出来了,咱们一定要会用才可以啊,不然太…. ...
- [Node.js] Use "prestart" in scripts
Usually we run : npm start to start an app, then we we might call other script to do something: npm ...
- (转)[老老实实学WCF] 第二篇 配置WCF
在上一篇中,我们在一个控制台应用程序中编写了一个简单的WCF服务并承载了它.先回顾一下服务端的代码: using System; using System.Collections.Generic; u ...
- css导航条
#nav ul { display: none; position: absolute; padding-top: 0px;} #nav li:hover ul { display: block;}
- performSelector的方法
在此我对performSelector系列方法进行了总结 1. - (id)performSelector:(SEL)aSelector; - (id)performSelector:(SEL)aSe ...
- lightoj 1236 正整数唯一分解定理
A - (例题)整数分解 Crawling in process... Crawling failed Time Limit:2000MS Memory Limit:32768KB 6 ...
- 一个经试用效果非常不错的数据库连接池--JAVA
前言: 虽说现在许多企业级的应用服务器均自己带有数据库连接池功能,就连 Tomcat 也支持了这种功能.然而在许多时候,我们还是要使用数据库连接池,如:访问数据库的 Java 桌面应用程序等.这个数据 ...
- line-height下的dispay:inline-block垂直居中
html: <div class="search fl"> <span class="search-box"> <input ty ...