[PyQt] comboBox inside a statusBar

alteo_gange romanocaldoni at free.fr
Wed Nov 7 16:27:54 GMT 2007


Le mercredi 07 novembre 2007, kib2 a écrit :
> For the moment, I use the "currentIndexChanged(int)"'s SLOT wich feets
> my needs, but I wanted to work with string, not int values.

Hi,

#!/usr/bin/python
# -*- coding: Utf-8 -*-

import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *

class Widget(QWidget):
	def __init__(self):
		QWidget.__init__(self)
		
		hbox=QHBoxLayout()
		
		combo = QComboBox()
		lst=["a","b","c","d","e"]
		for i in lst:
			combo.addItem(i)
		hbox.addWidget(combo)
		self.connect(combo,SIGNAL("activated(QString)"),self.changerItem)
		self.setLayout(hbox)
	
	def changerItem(self,i):
		print i


app = QApplication(sys.argv)
main = Widget()
main.show()
sys.exit(app.exec_())

-- 
alteo_gange




More information about the PyQt mailing list