Top 10 PyQt Interview Questions Answers

1). Explain what is Pyqt?
Ans: PyQt is a GUI widgets toolkit. It is a Python interface for Qt, one of the most powerful, and popular cross-platform GUI library.

2). PyQt was developed by which company?
Ans: PyQt was developed by RiverBank Computing Ltd.

3). PyQt is written in which language?
Ans: C++ / Python

4). What do you understand by PyQt API?
Ans: PyQt API is a large collection of classes and methods.

5). Name any five most frequently used classes?
Ans: QtCore: Core non-GUI classes used by other modules
QtGui: Graphical user interface components
QtMultimedia: Classes for low-level multimedia programming
QtNetwork: Classes for network programming
QtOpenGL: OpenGL support classes

6). What is the use of removeSubWindow() method?
Ans: Removes a widget that is internal widget of a subwindow.

7). Explain QSqlQuery with and example?
Ans: QSqlQuery class has the functionality to execute and manipulate SQL commands. Both DDL and DML type of SQL queries can be executed. The most important method in the class is exec_(), which takes as an argument a string containing SQL statement to be executed.
query = QtSql.QSqlQuery()
query.exec_("create table sportsmen(id int primary key,
   " "firstname varchar(20), lastname varchar(20))")

8). Name any three predefined QColor objects?
Ans: Qt.white

9). What is the use of The QClipboard class? Name any method of this class?
Ans: The QClipboard class provides access to system-wide clipboard that offers a simple mechanism to copy and paste data between applications. Its action is similar to QDrag class and uses similar data types.
setImage(): Copies QImage into clipboard

10). Is PyQt compatible with Linux OS?
Ans: PyQt is compatible with all the popular operating systems including Windows, Linux, and Mac OS. It is dual licensed, available under GPL as well as commercial license.



Contact Form