Advertisement
stuppid_bot

Untitled

Dec 13th, 2014
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.96 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. from PyQt4 import QtGui, QtCore
  3.  
  4. if __name__ == '__main__':
  5.     app = QtGui.QApplication([])
  6.     window = QtGui.QWidget()
  7.     window.setWindowTitle(u"Привет мир")
  8.     window.resize(250, 150)
  9.     # Создаем layot для выравнивания содержимого.
  10.     vlayout = QtGui.QVBoxLayout(window)
  11.     # В Qt можно использовать html теги.
  12.     label = QtGui.QLabel(u"<i>Привет, мир!</i>", window)
  13.     label.setAlignment(QtCore.Qt.AlignCenter)
  14.     # Кидаем на layout label. Теперь label будет занимать все доступное
  15.     # пространство окна.
  16.     vlayout.addWidget(label)
  17.     # Можно даже использовать CSS!
  18.     window.setStyleSheet("""
  19.        QWidget {
  20.            background: yellow;
  21.        }
  22.    
  23.        QLabel {
  24.            color: red;
  25.        }
  26.    """)
  27.     window.show()  
  28.     app.exec_()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement