# -*- coding: utf-8 -*-
# python:2.x
__author__ = ‘Administrator‘
from decimal import *
from PyQt4.QtGui import *
from PyQt4.Qt import *
from PyQt4.QtCore import *
from pngs import Ui_Dialog
import sys
class Example(QTableWidget,Ui_Dialog):
def __init__(self,args=None):
super(Example, self).__init__(args)
self.setupUi(self)
self.pushButton_2.clicked.connect(self.png1)
self.pushButton.clicked.connect(self.png2)
self.png1()
def png2(self):
path=QPixmap(r‘i/b.png‘)
self.png.setPixmap(path)
self.png.resize(path.width(),path.height())
def png1(self):
path=QPixmap(r‘i/a.png‘)
self.png.setPixmap(path)
self.png.resize(path.width(),path.height())
app =QApplication(sys.argv)
#QApplication.setQuitOnLastWindowClosed(False)退出在最后窗口关闭点击
x = Example()
x.show()
sys.exit(app.exec_())
pyqt 图片(label上显示