You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
calculate-utils-3-console-gui/api/gui/mainframe.py

48 lines
1.3 KiB

# -*- coding: utf-8 -*-
from PySide import QtGui
class Check(QtGui.QWidget):
def __init__(self):
super(Check, self).__init__()
self.initUI()
def initUI(self):
self.lbl = QtGui.QLabel("Ubuntu", self)
combo = QtGui.QComboBox(self)
combo.addItem("Ubuntu")
combo.addItem("Mandriva")
combo.addItem("Fedora")
combo.addItem("Red Hat")
combo.addItem("Gentoo")
combo.move(50, 50)
self.lbl.move(50, 150)
combo.activated[str].connect(self.onActivated)
self.setGeometry(0, 0, 150, 180)
self.show()
def onActivated(self, text):
if text == 'Gentoo':
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(50, 150)
self.lbl.show()
self.lbl.setText(text)
self.lbl.adjustSize()
class MainFrame (QtGui.QScrollArea):
def __init__(self, parent):
QtGui.QScrollArea.__init__(self)
# верхнее правое
check2 = Check()
self.setWidget(check2)
# self.resize(700,900)