Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- from PyQt4 import QtGui, QtCore
- if __name__ == '__main__':
- app = QtGui.QApplication([])
- window = QtGui.QWidget()
- window.setWindowTitle(u"Привет мир")
- window.resize(250, 150)
- # Создаем layot для выравнивания содержимого.
- vlayout = QtGui.QVBoxLayout(window)
- # В Qt можно использовать html теги.
- label = QtGui.QLabel(u"<i>Привет, мир!</i>", window)
- label.setAlignment(QtCore.Qt.AlignCenter)
- # Кидаем на layout label. Теперь label будет занимать все доступное
- # пространство окна.
- vlayout.addWidget(label)
- # Можно даже использовать CSS!
- window.setStyleSheet("""
- QWidget {
- background: yellow;
- }
- QLabel {
- color: red;
- }
- """)
- window.show()
- app.exec_()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement