pyqt 按钮调用例子学习

UI文件及代码文件:http://yunpan.cn/QCktWsjsgRakf(提取码:d330)

如下图:

.PY文件代码如下:

from a import Ui_Form

from b import Ui_Form1

import sys

from PyQt4.QtGui import  *

from PyQt4.QtCore import *

from PyQt4.Qt import *

class Exr02(QDialog,Ui_Form):

def __init__(self,parent=None):

super(Exr02,self).__init__(parent)

self.setupUi(self)

self.textnr()

self.pushButton.clicked.connect(self.dianyong)

def dianyong(self):

self.yn=Yn()

self.yn.show()

def textnr(self):

self.addlabel.setText(‘hello python\n‘

‘hello qt\n‘

‘win7 64bit\n‘

‘python2.7.8\n‘

‘zh‘)

class Yn(QDialog,Ui_Form1):

def __init__(self,parnet=None):

super(Yn,self).__init__(parnet)

self.setupUi(self)

self.pushButton.clicked.connect(self.Yesclose)

self.pushButton_2.clicked.connect(self.Noclose)

def Yesclose(self):

self.close()

def Noclose(self):

pass

app=QApplication([])

e=Exr02()

e.show()

sys.exit(app.exec_())

时间: 2024-11-07 11:04:42

pyqt 按钮调用例子学习的相关文章

pyqt QTableWidget例子学习(重点)

# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from PyQt4.Qt import * from PyQt4.QtCore import * lista = ['aa', 'ab', 'ac'] listb = ['ba', 'bb', 'bc'] listc = ['ca', 'cb', 'cc'] mystruct = {'A':lista, 'B':

pyqt 正则表达式例子学习

def rex01(self): username=QtCore.QRegExp('[a-zA-Z0-9_]{2,10}') self.names.setValidator(QtGui.QRegExpValidator(username,self)) mainname=QtCore.QRegExp("^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$") self.mains.setValidator(QtGui.QRegExpValidator(mainnam

pyqt QTimer,QThread例子学习

# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from PyQt4.Qt import * from PyQt4.QtCore import * from start import Ui_Form import sys class Example(QDialog,Ui_Form): def __init__(self,parent=None): super(E

pyqt单选,复选等例子学习

# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from PyQt4.Qt import * from PyQt4.QtCore import * from check1 import Ui_Dialog from check2 import Ui_Dialog1 from check3 import Ui_Dialog2 import sys QTextCod

pyqt columnView例子学习

# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import  * from PyQt4.Qt import * from PyQt4.QtCore import * import sys class Tree(QColumnView): def __init__(self,parnet=None,*args): super(Tree,self).__init__(parnet,

pyqt 托盘例子学习

# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import * from PyQt4.Qt import * from PyQt4.QtCore import * from tp import Ui_Form import sys from PyQt4.QtCore import Qt QTextCodec.setCodecForTr(QTextCodec.codecForNa

pyqt tabWidget例子学习1

from PyQt4 import QtGui from PyQt4 import QtCore from PyQt4.QtCore import pyqtSlot,SIGNAL,SLOT import sys class myTabWidget(QtGui.QTabWidget): def tabChangedSlot(self,argTabIndex): QtGui.QMessageBox.information(self,"Tab Index Changed!", "C

pyqt QTreeWidget例子学习

# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' from PyQt4.QtGui import  * from PyQt4.Qt import * from PyQt4.QtCore import * import sys class Tree(QMainWindow): def __init__(self,parnet=None): super(Tree,self).__init__(parnet) self.

pyqt ColumnView, QFileSystemModel, QSplitter, QTreeView例子学习(由官方例子提供学习)

from PyQt4.QtGui import (QApplication, QColumnView, QFileSystemModel, QSplitter, QTreeView) #注意 """ QColumnView类提供了一个模型/视图列视图的实现,继承QAbstractItemView 提供了一个本地文件系统的数据模型,继承QAbstractItemModel 实现了一个分流器小部件,继承qframe 提供了一个默认的模型/视图树视图的实现,继承QAbstractI