2 mhxy13867806343 mhxy13867806343 于 2014.03.29 21:12 提问

python简化代码,在线等!

def tab1(self,x):
#tab=QtGui.QTableWidgetItem()
#tab.setSelected(1)
for i in self.visi.sizeTab.colorbuck.selectedItems():
if i.row()==0:
s=QtGui.QImage(r'listimage\ab (1).jpg')
self._tools.label_16.setPixmap(QtGui.QPixmap.fromImage(s))
if i.column()==1:
s0=QtGui.QImage(r'listimage\c.png')
self._tools.label_16.setPixmap(QtGui.QPixmap.fromImage(s0))
if i.row()==1:
s1=QtGui.QImage(r'listimage\ab (2).jpg')
self._tools.label_16.setPixmap(QtGui.QPixmap.fromImage(s1))
if i.column()==1 and i.row()==1:
s1=QtGui.QImage(r'listimage\ab (3).jpg')
self._tools.label_16.setPixmap(QtGui.QPixmap.fromImage(s1))
if i.row()==2:
s1=QtGui.QImage(r'listimage\ab (4).jpg')
self._tools.label_16.setPixmap(QtGui.QPixmap.fromImage(s1))
if i.column()==1 and i.row()==2:
s1=QtGui.QImage(r'listimage\ab (5).jpg')
self._tools.label_16.setPixmap(QtGui.QPixmap.fromImage(s1))
if i.row()==3:
s1=QtGui.QImage(r'listimage\ab (6).jpg')
self._tools.label_16.setPixmap(QtGui.QPixmap.fromImage(s1))
if i.column()==1 and i.row()==3:
s1=QtGui.QImage(r'listimage\ab (7).jpg')
self._tools.label_16.setPixmap(QtGui.QPixmap.fromImage(s1))
那位大神帮我简化下代码!

1个回答

c123c456c
c123c456c   2014.04.01 23:12

你能不能把缩进写好呢?都看不清楚你的代码

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!