How often Widgets and menus is asked
3 of 3
papers asked it
avg 26 marks · last May 2018
Worth 1–8 marks when it appears as a written question.
Where it was asked
The questions
May/Jun 2018, Q2.14 marks
Define what a widget is in the context of Python GUI development, listing at least four characteristics of widgets, and provide coded examples that illustrate your explanation.
May/Jun 2018, Q2.24 marks
Explain what a table widget is used for, and give the code required to add data to a table widget using the setItem() method.
May/Jun 2018, Q2.34 marks
Describe what menus are used for in the development of Python applications, and explain how menus are linked to the Action Editor. A screenshot of a window titled 'MainWindow - untitled' containing a text field labelled 'Type Here' is provided alongside this question, though the image is of poor print quality.
May/Jun 2018, Q2.48 marks
An application can display a system clock's time on an LCD widget. Complete the partially-written program shown below (file showtime.pyw) by filling in the six numbered blank lines, marked # (1) through # (6), with the relevant code and comments that explain the specifics of each line in context. The program is as follows: it imports sys and everything from disptime; defines a class MyForm(QtGui.QDialog) whose __init__ method calls QtGui.QWidget.__init__(self, parent), sets up self.ui = Ui_Dialog() and calls self.ui.setupUi(self), then at blank (1) something must be inserted, followed by the line timer = QtCore.QTimer(self); at blank (2) something must be inserted, followed by the line timer.timeout.connect(self.showlcd); at blank (3) something must be inserted, followed by the lines timer.start(1000) and self.showlcd(). The class also defines a method showlcd(self), which at blank (4) requires an insertion, followed by the line time = QtCore.QTime.currentTime(); at blank (5) requires an insertion, followed by the line text = time.toString('hh:mm'); and at blank (6) requires an insertion, followed by the line self.ui.lcdNumber.display(text). Finally, the program's main block checks if __name__ == "__main__", creates app = QtGui.QApplication(sys.argv), creates myapp = MyForm(), calls myapp.show(), and calls sys.exit(app.exec_()).
Oct/Nov 2017, Q1.1(a)2 marks
With reference to the relevant widget name and class name, explain how LCD-like digits are displayed in a Python application.
The full Spot Map and the marks by year.