Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

26.1 Знакомство с PyQt

Total questions: 6

Worksheet time: 6mins

Name
Class
Date
1.

Установка библиотеки PyQt 5 выполняется командой

a)
apt-get install PyQt5
b)
yum install PyQt5
c)

pip install PyQt5

d)
brew install PyQt5
2.

Выражение label = QtWidgets.QLabel("<center>Привет, мир!</center>") выведет:

a)
The QLabel will display the text '
Привет, мир!
' with the HTML tags visible.
b)
The QLabel will display an error message due to incorrect syntax.
c)
The QLabel will display the text '<center>Привет, мир!</center>' as it is.
d)
The QLabel will display the text 'Привет, мир!' without any HTML tags.
3.

Выражение:

window.setWindowTitle("Программа на PyQt")

a)

задает текст, который будет выводиться в заголовке окна, для чего используется метод

setWindowTitle()

b)

Запускает приложение окна

c)
Python
d)
C++
4.

Выражение window.resize(300, 70) делает

a)
Closes the window
b)
Maximizes the window
c)
Minimizes the window
d)
Resizes the window
5.

выражение:

btnQuit = QtWidgets.QPushButton("&Закрыть окно")

a)
QPushButton с текстом 'Закрыть окно' и комбинацией клавиш 'Alt+З'
b)
QLineEdit с текстом 'Закрыть окно'
c)
QLabel с текстом 'Закрыть окно'
d)
QComboBox с текстом 'Закрыть окно'
6.

Вася написал код. но он не работает. помогите Васе

from PyQt5 import QtWidgets


class MyWindow(QtWidgets.QWidget):
def init(self, parent=None):
QtWidgets.QWidget.__init__(self, parent)
label = QtWidgets.QLabel("Привет, мир!")
label.setAlignment(QtCore.Qt.AlignHCenter)
btnQuit = QtWidgets.QPushButton("&Закрыть окно")
vbox = QtWidgets.QVBoxLayout()
vbox.addWidget(self.label)
vbox.addWidget(self.btnQuit)
setLayout(self.vbox)
btnQuit.clicked.connect(QtWidgets.qApp.quit)


if name == "__main__":
import sys

app = QtWidgets.QApplication(sys.argv)
window = MyWindow()
window.setWindowTitle("ООП-стиль окна")
window.resize(300, 70)
window.show()
sys.exit(app.exec_())

4 lines