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 ...
随机推荐
- iptables 实现centos内网机器访问外网
环境:一台带外网和内网的机器,另一台只有内网,默认不能上网.两台机器都是centos系统带外网机器的外网ip为 123.221.20.11, 内网ip为 192.168.15.100内网机器的内网ip ...
- Canvas简单动画和像素处理
动画 利用JavaScript,可以在canvas元素上很容易地产生动画效果. var posX = 20, posY = 100; setInterval(function() { context. ...
- 《第一行代码》学习笔记6-活动Activity(4)
1.SecondActivity不是主活动,故不需要配置标签里的内容. 2.Intent是Android程序中各组件之间进行交互的一种重要方式,一般可被用于 启动活动,启动服务,以及发送广播等.Int ...
- [转]Sql Server 2005中的架构(Schema)、用户(User)、登录(Login)和角色(Role)
每一个概念的产生必然是因为碰到了无法解决的问题.换句话说,如果没有它,必然会导致某些问题难以解决.所以我想从这个角度切入,希望能把这几个复杂而暧昧的多角关系从最实用的角度来阐述清楚. 在问题的最初,我 ...
- 理解SQL SERVER中的分区表(转)
简介 分区表是在SQL SERVER2005之后的版本引入的特性.这个特性允许把逻辑上的一个表在物理上分为很多部分.而对于SQL SERVER2005之前版本,所谓的分区表仅仅是分布式视图,也就是多个 ...
- UISearchDisplayController简单使用
最近在做一个简单的app入门,中间有一个页面用到了搜索框,本来以为很简单的控件,没想到用到的时候才发现很麻烦. 搜索框使用过程大约有以下几个状态:不活跃-活跃-输入关键词-根据关键词动态列出相关结果- ...
- VC防止程序被多次运行 互斥体方法
BOOL CXXXApp::InitInstance() //函数内添加代码 HANDLE hMutex=CreateMutex(NULL,TRUE,"test"); // 用于检 ...
- C# 温故而知新:Stream篇(—)
C# 温故而知新:Stream篇(—) 目录: 什么是Stream? 什么是字节序列? Stream的构造函数 Stream的重要属性及方法 Stream的示例 Stream异步读写 Stream 和 ...
- ul li a active jquery.cookie.js
div class="righter nav-navicon" id="admin-nav"> <div class="mainer&qu ...
- rr
times = gcd(rotdist,length); printf( ;i<times;i++) { t = vec[i]; j = i; ) { k = j+ r ...