今天,帮一网友改程序,非常郁闷,一个小bug找了很就,于是把程序写下,作下记录:
程序的功能大致是,点击四个按钮,分别显示四个图片在窗口!
先上程序:
__author__ = 'Administrator'
try:
from PySide import QtCore
from PySide import QtGui
except ImportError:
from PyQt4 import QtCore
from PyQt4 import QtGui
class Mainwindow(QtGui.QWidget):
def __init__(self):
super(Mainwindow,self).__init__()
self.img1=QtGui.QImage("D:\myicon.jpg")
self.img2=QtGui.QImage("D:\one.jpg")
self.img3=QtGui.QImage("D:\m2yicon.jpg")
self.img4=QtGui.QImage("D:\myi3con.jpg")
button1 = QtGui.QPushButton("1")
button2 = QtGui.QPushButton("2")
button3 = QtGui.QPushButton("3")
button4 = QtGui.QPushButton("4")
button1.clicked.connect(self.slotbutton1)