Test Bank Answers Gui Programming Chapter.13 - Test Bank | Python 5e by Gaddis by Tony Gaddis. DOCX document preview.
Starting Out with Python 5e (Gaddis)
Chapter 13 GUI Programming
TRUE/FALSE
1. Python does not have GUI programming features built into the language itself.
2. Programs that use tkinter do not always run reliably in IDLE.
3. A root widget's destroy method can be used as a callback function for a Quit button.
4. Radio buttons can be used to allow the user to make multiple selections at one time.
5. Checkbutton widgets are displayed in groups and used to make mutually exclusive selections.
6. In a GUI environment, no text input is possible.
7. The pack method determines where a widget should be positioned.
8. An info dialog box is a window that displays a message to the user and has an OK button which, when clicked, closes the dialog box.
9. To use an Entry widget to get data entered by a user, you must use the Entry widget's set method.
10. The Entry widget's get method retrieves either numeric or string data.
11. To use the showinfo function, the tkinter.messagebox module must be imported.
12. By default, a Listbox widget does not display scrollbars.
13. You can add different amounts of padding to each side of a widget.
14. The point (0,0) represents the same place in a window with the Canvas widget as with turtle graphics.
MULTIPLE CHOICE
1. What are the items that appear on the graphical interface window called?
a. | buttons |
b. | icons |
c. | widgets |
d. | graphical elements |
2. A __________ program is an event-driven program.
a. | GUI |
b. | command line |
c. | procedural |
d. | modular |
3. Which widget allows the user to select a value by moving a slider along a track?
a. | Scrollbar |
b. | Toplevel |
c. | Scale |
d. | Slider |
4. Which widget will display multiple lines of text?
a. | Label |
b. | Canvas |
c. | Message |
d. | Text |
5. Which widget creates an area that displays one line of text or an image?
a. | Label |
b. | Canvas |
c. | Message |
d. | Text |
6. Which widget allows the user to enter a single line of input from the keyboard?
a. | Toplevel |
b. | Entry |
c. | Message |
d. | Text |
7. In an event-driven program, the __________ accepts the user's commands.
a. | register |
b. | CPU |
c. | operating system |
d. | GUI |
8. In an event-driven environment, the user interacts with
a. | the graphical unit |
b. | the user interface |
c. | the register |
d. | the CPU |
9. The acronym GUI stands for
a. | Graphical User's Interface |
b. | Graphical User Interface |
c. | Graphical User Interaction |
d. | Graphical Union Interface |
10. In Python, what module is used to create a GUI program?
a. | tkinter |
b. | pygui |
c. | python_gui |
d. | pycanvas |
11. In a GUI environment most interactions are done through small windows known as __________ that display information and allow the user to perform actions.
a. | input boxes |
b. | windows |
c. | dialog boxes |
d. | message boxes |
12. In a(n) __________ interface, a prompt is displayed that allows the user to enter a command which is then executed.
a. | windows |
b. | command line |
c. | GUI |
d. | operating |
13. In a(n) __________ interface, the user can determine the order in which things happen.
a. | windows |
b. | command line |
c. | GUI |
d. | operating |
14. A widget can appear with these types of padding.
a. | internal and external |
b. | upper and lower |
c. | left and right |
d. | north, south, east, and west |
15. Which of these is not a valid relief style for borders?
a. | flat |
b. | raised |
c. | sunken |
d. | smooth |
16. Which of the following is not a method of the Canvas widget?
a. | create_line |
b. | create_oval |
c. | create_button |
d. | create_text |
17. A __________ widget displays a list of items and allows the user to select one or more items from the list.
a. | Itembox |
b. | SelectionList |
c. | Menubox |
d. | Listbox |
18. A __________ is a container that can be used to organize the widgets in a window.
a. | Textbox |
b. | Label |
c. | Frame |
d. | Canvas |
19. What is the default selection mode of a Listbox widget?
a. | tkinter.BROWSE |
b. | tkinter.EXTENDED |
c. | tkinter.MULTIPLE |
d. | tkinter.SINGLE |
20. What does the Listbox widget's curselection method return?
a. | A tuple containing the items that are currently selected in the Listbox |
b. | Either True or False to indicate whether an item is currently selected |
c. | A tuple containing the indexes of the items that are currently selected in the Listbox |
d. | The item that is currently stored at index 0 in the Listbox |
21. Which of the following must you include with your program so you can display a message to the user with the showinfo function?
a. | import tkinter |
b. | import canvas import messagebox |
c. | import messagebox |
d. | import tkinter import tkinter.messagebox |
22. Given the following code, which line defines the size of the window?
import tkinter
class myShape:
def __init__(self):
self.main_window = tkinter.Tk()
self.canvas = tkinter.Canvas(self.main_window,
width=200, height=200)
self.canvas.create_rectangle(30,30, 175, 175)
self.canvas.pack()
tkinter.mainloop()
shape = myShape()
a. | self.main_window = tkinter.Tk() |
b. | self.canvas = tkinter.Canvas(self.main_window,width=200, height=200) |
c. | self.canvas.create_rectangle(30,30, 175, 175) |
d. | shape = myShape() |
23. Given the following code, what are the dimensions, in pixels, of the shape created?
import tkinter
class myShape:
def __init__(self):
self.main_window = tkinter.Tk()
self.canvas = tkinter.Canvas(self.main_window,
width=200, height=200)
self.canvas.create_rectangle(30,30, 175, 175)
self.canvas.pack()
tkinter.mainloop()
shape = myShape()
a. | 200 X 200 |
b. | 30 X 175 |
c. | 145 X 145 |
d. | None of these |
COMPLETION
1. A(n) __________ allows the user to interact with the operating system and other programs through graphical elements on the screen.
2. The GUI popularized the use of the __________ as an input device.
3. __________ are small windows that display information and allow the user to perform actions.
4. Since GUI programs respond to the actions of the user, they are called __________ programs.
5. The __________ module allows you to create GUI programs in Python.
6. The __________ widget is used to display text in a window.
7. The Label widget's __________ method determines where a widget should be positioned and makes the widget visible when the main window is displayed.
8. A(n) ___________ is a container that can hold other widgets and organize the widgets in a window.
9. A(n) __________ function is a function or method that executes when the user clicks a button.
10. A(n) __________ is a widget that the user can click to cause an action to occur.
11. To bind a callback function to a Listbox, you call the Listbox widget's _______ function.
12. You can remove an item from a Listbox by calling the Listbox widget's _______ method.
13. The __________ widget provides methods that allow the programmer to draw some simple shapes.
14. To create a line with the create_line method of the Canvas widget, you must include four arguments that represent beginning and ending __________.