# -*- coding: utf-8 -*- from PySide import QtGui class Checkbox(QtGui.QWidget): def __init__(self): super(Checkbox, self).__init__() self.initUI() def initUI(self): self.lbl = QtGui.QLabel("Town", self) self.combo = QtGui.QComboBox(self) self.combo.addItem("Town") self.combo.addItem("City") self.combo.addItem("Village") self.combo.move(50, 50) self.lbl.move(150, 50) self.combo.activated[str].connect(self.onActivated) self.setGeometry(50, 50, 200, 100) self.show() def onActivated(self, text): if text == 'Village': if hasattr (self, 'lbl'): #if 'lbl' in self: self.lbl.hide() del self.lbl else: if not hasattr (self, 'lbl'): self.lbl = QtGui.QLabel(text, self) self.lbl.move(150, 50) self.lbl.show() self.lbl.setText(text) self.lbl.adjustSize() class StatusField (QtGui.QFrame): def __init__(self, parent): # создание нижнего фрейма # bottom = QtGui.QFrame(self) QtGui.QFrame.__init__(self) tempbox3 = QtGui.QHBoxLayout(self) check3 = Checkbox() self.scrollArea3 = QtGui.QScrollArea() self.scrollArea3.horizontalScrollBar().hide() self.scrollArea3.setWidget(check3) # self.resize(800,10) tempbox3.addWidget(self.scrollArea3) self.setLayout(tempbox3) check3.combo.activated[str].connect(parent.statusbar.showMessage)