Make a choice with a ComboBox, PyQT -


how ?

i create programme wherein propose choice combobox.

for exemple, if choice item in combobox, write in spinbox. probléme that, wirte in third spinbox without create new combobox.

hope understand

check out :)

`

# -*- coding: utf-8 -*- import sys pyqt4.qtcore import qt pyqt4.qtgui import (qapplication, qwidget, qvboxlayout, qspinbox, qcombobox)    class widget(qwidget):     def __init__(self):         super(widget, self).__init__()         self.layout = qvboxlayout(self)         self.spin = qspinbox(self)         self.spin2 = qspinbox(self)         self.spin3 = qspinbox(self)          self.combo = qcombobox(self)         self.combo2 = qcombobox(self)          self.layout.addwidget(self.spin)         self.layout.addwidget(self.spin2)         self.layout.addwidget(self.spin3)         self.layout.addwidget(self.combo)         self.layout.addwidget(self.combo2)          self.combo.currentindexchanged['qstring'].connect(self.on_combo_changed)         self.combo2.currentindexchanged['qstring'].connect(self.changed)           self.data = {"handset1": 5,"handset": 6, "handfree": 10, "car kit": 15, "rsm": 20}         self.dodo = {"handset1": 44, "handset": 76, "handfree": 1, "car kit": 7, "rsm": 0}         self.coco = {"handset1": 0, "handset": 7, "handfree": 11, "car kit": 77, "rsm": 10} # how put function, without create other combobox ?          self.combo.additems(self.data.keys())         self.combo2.additems(self.dodo.keys())       def on_combo_changed(self, txt):         self.spin.setvalue(self.data[unicode(txt)])     def changed(self, txt):         self.spin2.setvalue(self.coco[unicode(txt)])  if __name__ == '__main__':     app = qapplication([])     w = widget()     w.show()     sys.exit(app.exec_()) 

`


Comments

Popular posts from this blog

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -