MyTetra Share
Делитесь знаниями!
1. Первая программа
Время создания: 07.09.2017 15:18
Текстовые метки: task
Раздел: Python - PyQt4 - Задачник - Прохоренок
Запись: xintrea/mytetra_db_mcold/master/base/150478668656pm6uuen9/text.html на raw.githubusercontent.com


# coding: utf-8
import sys
from PyQt4 import QtGui, QtCore

if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
# create object of application
print(QtGui.qApp.argv()) # print sequence of application's arguments
window = QtGui.QWidget() # create window
window.setWindowTitle("Первая программа на PyQt") # set title of window
window.resize(300, 70) # change size of window
label = QtGui.QLabel("<center>Привет, мир</center>") # create label
btnQuit = QtGui.QPushButton("&Закрыть окно") # create button
vbox = QtGui.QVBoxLayout() # create vertical sizer
vbox.addWidget(label) # add label to sizer
vbox.addWidget(btnQuit) # add button to sizer
window.setLayout(vbox) # set sizer as layout of window
QtCore.QObject.connect(btnQuit, QtCore.SIGNAL('clicked()'), QtGui.qApp, QtCore.SLOT("quit()")) # write command to quit from application in acting on button
window.show() # show window
sys.exit(app.exec_()) # execute application

Так же в этом разделе:
 
MyTetra Share v.0.59
Яндекс индекс цитирования