GRADED
Dialogs are of two types
Modal and Modeless
one that blocks the user from interacting with other parts of the application.
Modal
Modeless
Modal dialog
________dialog is the opposite of a modal dialog
Modeless
Until the dialog is __________, no other part of the application can be accessed.
Closed
When a _______________________ is active, the user is free to interact with the
dialog and with the rest of the application.
Modeless dialog
There are two ways to write a GUI application
From scratch
With Qt Designer
The GUI applications will be saved with the _______ extension
.py
.pyw
.exe
.pyw
Imports the necessary modules. The basic GUI widgets are located in the QtGui
module
from PyQt4 import QtGui, QtCore
QWidget is the base class of all user interface objects in PyQt4,
#so you are creating a new demowind class that inherits from the base class,
QWidget
class demowind(QtGui.QWidget):
___________is the base class of all user interface objects in
PyQt4
QWidget
Provides the default constructor for QWidget
QtGui.QWidget.__init__(self, parent)
The default constructor has no ___________
parent
A widget with no parent is known as a _____________
Window
__________sets the size of the window and defines
where to place it.
, QWidget
Demowind
setGeometry()
setGeometry()
The first two parameters of the setGeometry () are the ___ and
____ locations at which the window will be placed
x and y
The third parameters of the setGeometry () is the ______,and the fourth is the
__________ of the window
width and height
This statement sets the window title to Demo Window.
self.setWindowTitle('Demo window')
Creates a pushbutton with the text Close
quit = QtGui.QPushButton('Close', self)
Defines the width and height of the pushbutton
quit.setGeometry(10, 10, 70, 40)
Event handling in PyQt4 uses
signals and slots
Which one is an event?
Signal
or
slot
signal
Which one is a method
Signal
or
slot
slot
Creates an application object with the name app through
the QApplication() method of the QtGui module
app = QtGui.QApplication
PyQt4 application must create an application object which is _________
sys.argv
An instance of the demowind class is created with the name dw
dw = demowind()
The ___________ method will display the widget on the
screen.
dw.show()
The __________method ensures a clean exit
sys.exit()
Creates a form with OK and Cancel buttons in the right bottom corner.
Dialog with buttons at the bottom