import sys
from PyQt5 import QtWidgets
class Widget(QtWidgets.QWidget):
def __init__(self):
super().__init__()
self.resize(100, 100)
self.button = QtWidgets.QPushButton('Button', self)
self.button.clicked.connect(self.visible_lab)
self.newLabel = QtWidgets.QLabel(self)
self.newLabel.setText('Hellow Wrold')
self.newLabel.move(10, 50)
self.newLabel.setVisible(False)
def visible_lab(self):
self.newLabel.setVisible(True)
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
main = Widget()
main.show()
sys.exit(app.exec_())
import sys
from PyQt5 import QtWidgets
class Widget(QtWidgets.QFrame):
def __init__(self):
super().__init__()
self.btn = QtWidgets.QPushButton(self)
self.btn.clicked.connect(self.show_wind)
def show_wind(self):
self.wind = QtWidgets.QFrame()
self.wind.resize(200, 200)
self.wind.show()
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
main = Widget()
main.show()
sys.exit(app.exec_())
это для PyQt5 но принцип один
QPushButton#exit_button {
border-image: url(resources/icons/64/exit.png);
}
QPushButton#config_button {
border-image: url(resources/icons/64/config.png);
}