Courseiva

PCPP1 · domain

Graphical User Interface Programming

This domain covers building desktop GUIs with Python's Tkinter: widget creation and configuration, geometry managers (pack, grid, place), event binding, and the Canvas drawing API. Questions present concrete coding scenarios—drawing shapes, wiring callbacks, laying out widgets—and ask you to pick the correct method call, parameter, or event string.

58 questions15 easy24 medium19 hard

Focused practice

Practice Graphical User Interface Programming questions

Scored sessions drawing only from this domain — pick a length below.

Start 20-question practice test →

What this domain covers

What to know about Graphical User Interface Programming

Be able to instantiate Tk widgets, place them with pack/grid/place, bind events using correct sequence strings, and call Canvas drawing methods with proper coordinates and options. The single most important thing: know exact Tkinter method names, parameter keywords, and event sequence syntax, since questions hinge on precise API details.

Canvas methods such as create_rectangle, create_oval, and create_line with coordinate and fill options

Event binding via widget.bind, including sequence strings like <Button-1> and <ButtonRelease-1>

Grid geometry manager parameters: row, column, rowspan, columnspan, sticky, and padx/pady

Window and widget configuration: Tk title, geometry, mainloop, and widget option keywords

Why learners struggle

Why Graphical User Interface Programming questions are commonly missed

RAM questions are commonly missed because learners confuse physical form factors (DIMM vs SO-DIMM) and fail to distinguish between memory speed (MHz) and latency (CL).

  • ·DIMM vs SO-DIMM — desktop vs laptop form factor confusion
  • ·DDR3 vs DDR4 vs DDR5 — notch position and voltage differences
  • ·MHz vs CL — speed vs latency trade-offs in performance
  • ·Single-channel vs dual-channel — bandwidth impact misconception
  • ·ECC vs non-ECC — error correction support in servers vs desktops
  • ·32-bit vs 64-bit — maximum addressable RAM limit

Watch out for

Common Graphical User Interface Programming exam traps

  • ▸Confusing Canvas coordinate order or using width/height instead of x1,y1,x2,y2 for create_rectangle.
  • ▸Writing event strings incorrectly, e.g. <Button1> or <LeftClick> instead of <Button-1>.
  • ▸Mixing geometry managers in one container, or using grid without specifying row and column.

Question index

All Graphical User Interface Programming questions (58)

Click any question to see the full explanation, or start a practice session above.

1

You are implementing a custom Tkinter widget that must validate user input in an Entry field and prevent non-numeric characters from being entered. Which mechanism should you use to intercept and optionally reject each keystroke before it modifies the Entry contents?

Hard
2

A Tkinter application has a modal dialog implemented as a Toplevel that collects a numeric discount. The dialog's OK button command calls a validator that may raise ValueError, and you want the dialog to stay open with an inline error label rather than crashing the mainloop. The dialog is opened from the main window with dialog.grab_set() followed by main_window.wait_window(dialog). Which approach correctly keeps the error visible and prevents the exception from propagating out of the Tkinter callback?

Hard
3

Which TWO of the following events are commonly bound in Tkinter for mouse interaction?

Medium
4

When using the place() geometry manager, what is the purpose of 'relx' and 'rely'?

Hard
5

You are developing a Tkinter application that includes a Button widget. When the user clicks the button, you need to execute a function named handle_click that accepts no arguments. Which approach correctly associates this function with the button's click event?

Medium
6

Which TWO of the following are valid ways to add padding to a widget in the grid layout?

Hard
7

You are building a Tkinter GUI that includes a Canvas widget. You want to draw a rectangle and then later change its fill color without redrawing the entire canvas. Which method should you use to update the rectangle's fill color?

Hard
8

You are building a canvas-based drawing tool and need to detect when the user clicks on a specific rectangle item to select it, while other clicks should be ignored. Which canvas feature should you use?

Hard
9

A Tkinter data-entry form uses an Entry widget for a numeric amount. Users report that pressing Enter in the Entry does nothing, and the value is only saved when they click a separate Save button. You want Enter to trigger the same save routine as the button, without duplicating logic. Which binding achieves this?

Medium
10

A Tkinter application has a main window containing a Text widget used as a log console. The application performs a long-running data import and must remain responsive, so the import runs in a background thread. The worker thread needs to append status lines to the Text widget. Which approach is correct?

Medium
11

How do you access the value of a StringVar associated with an Entry widget?

Hard
12

You are developing a Tkinter application that uses multiple threads to perform background tasks. One thread updates a Label widget's text using its config method. Occasionally, the application crashes with a Tcl error about calling from a different thread. What is the correct approach to safely update the GUI from a background thread?

Hard
13

You are building a Tkinter application with a Button widget that should run a long-running calculation when clicked, but the GUI freezes until the calculation finishes. Which approach best keeps the interface responsive while performing the calculation?

Medium
14

You need to add a label that displays static text in your GUI. Which widget is most appropriate for this purpose?

Easy
15

You are prototyping a Tkinter application and want a single-line input field where users can type a search term. The field should also show a placeholder-like behavior by pre-filling the text 'Search...' when the window opens. Which widget and option combination achieves this most directly?

Easy
16

You wish to group several widgets together within a frame. Which widget acts as a container for this purpose?

Medium
17

You are creating a Tkinter application with a Canvas widget. You draw a circle using create_oval and assign it the tag 'ball'. Later, you want to move the circle 10 pixels to the right and 5 pixels down. Which Canvas method should you use?

Easy
18

You are designing a Tkinter application that uses a ttk.Treeview to display a table of records. You need to configure the widget so that users can select multiple non-contiguous rows and so that the first column shows a tree-style expander control. Which two actions must you perform? (Choose two.)

Medium
19

You are creating a simple Tkinter application and notice that your window does not appear on the screen after calling the Tk() constructor. Which method must be called to start the event loop?

Easy
20

You have a Checkbutton and you need to track its state. What is the recommended way to associate a variable with the Checkbutton?

Medium
21

A colleague built a Tkinter form where every Entry widget uses `pack()` in the same frame. They now need the labels to sit in a single column with the entries aligned in the next column and the whole form centered. They ask you to recommend the smallest structural change that makes this alignment reliable. What should you suggest?

Hard
22

When using the grid layout manager, which option allows a column to grow when the window is resized?

Hard
23

You are reviewing a Tkinter application that uses ttk widgets and a Canvas to draw a seating chart. The chart must redraw when the window is resized, and a toolbar above it must stay a fixed height. Which two techniques correctly contribute to a layout where the Canvas expands and the toolbar does not? (Choose two.)

Hard
24

You are designing a Tkinter application with a Listbox widget that displays multiple items. You want to allow the user to select multiple non-contiguous items (e.g., by holding Ctrl and clicking). Which configuration option of the Listbox should you set, and to what value?

Hard
25

You are writing a Tkinter dialog that must react to a user pressing the Escape key at any time, even when focus is inside an Entry widget. You have a function named on_cancel. Which binding correctly achieves this?

Hard
26

You are creating a Tkinter application with a menu bar. You want to add a keyboard shortcut (accelerator) to a menu item so that pressing Ctrl+S triggers the save action. Which option of the add_command method should you use to display the shortcut text, and what additional step is required to make the shortcut functional?

Medium
27

You have a list of options and want the user to select one using a dropdown menu. Which widget should you use?

Medium
28

Which THREE of the following are valid parameters for the pack() layout manager?

Medium
29

You are developing a Tkinter application with a top-level window that contains a Frame widget. Inside the Frame, you place three Button widgets using grid(). Later, you need to add a fourth Button that should span the full width of the Frame, below the existing three. Which grid() configuration should you apply to the new Button?

Medium
30

Which widget is most appropriate for displaying a list of selectable items?

Medium
31

A desktop tool built with Tkinter needs a list of departments shown as mutually exclusive radio buttons. When the user selects a department, the underlying model object's department attribute must update immediately, and the code must read the selection later without iterating over every radio button. Which Tkinter mechanism best satisfies these requirements?

Easy
32

Which TWO of the following are valid geometry managers in Tkinter?

Easy
33

A Tkinter application uses a Canvas to draw a seating chart. Each seat is a rectangle created with create_rectangle, and seats are grouped by section. When a section is selected, every seat in it must change fill color, and some seats must later be moved to a new position. Which strategy best supports efficient grouped updates while keeping individual seats addressable?

Hard
34

You are maintaining a Tkinter inventory application where users type quantities into an Entry widget. A colleague reports that the application accepts "12.5" for an item that must be a whole number, and invalid keystrokes are only caught after the user clicks Save. You must reject non-numeric input as it is typed, while still allowing a normal editing experience. Which mechanism should you register on the Entry widget?

Medium
35

You are building a Tkinter desktop application with a menu bar. Users report two problems: keyboard shortcuts such as Ctrl+S do not trigger the Save command when focus is inside a Text widget, and mnemonic underlines on the File menu are missing. You must correct the menu configuration. Which two changes should you make? (Choose two.)

Hard
36

You are creating a dialog window in a Tkinter application that must block interaction with the main window until the user closes it, and must return a value to the caller. Which approach correctly implements this behavior?

Medium
37

Which THREE of the following widgets are part of the 'ttk' (Themed Tkinter) module?

Hard
38

Which module must be imported to utilize Tkinter in a Python script?

Easy
39

You have a Button widget and want to trigger a function named 'process_data' when the user clicks it. Which is the standard way to associate the function with the button?

Easy
40

You are placing several widgets in a window using the grid() geometry manager and want a widget to span multiple columns in the same row. Which grid() option accomplishes this?

Easy
41

You are building a Tkinter application with a menu bar. You want to add a 'File' menu with an 'Exit' item that terminates the application when selected. Which command should you associate with the 'Exit' menu item to properly close the application?

Medium
42

You are creating a Tkinter GUI with a Canvas widget to draw a simple chart. You need to draw a filled blue rectangle from (50, 50) to (150, 100). Which Canvas method call achieves this?

Easy
43

You maintain a Tkinter inventory dashboard whose main window contains a large frame with a Treeview listing warehouse items. Operators complain that when they maximize the window, the Treeview stays at its original size and leaves a large empty gray area. The frame is already managed with grid() and the Treeview is placed inside that frame with pack(). Which single change most directly makes the Treeview grow with the frame when the window is resized?

Medium
44

You are building a Tkinter application that uses a ttk.Treeview to display a list of employees. Each employee has an ID, name, and department. You want to display the data in columns with headings, and you need the ID column to be hidden. Which approach correctly configures the Treeview to achieve this?

Hard
45

In a Tkinter grid layout, you want a button to span across two columns. Which parameter should you use?

Medium
46

What is the correct way to specify the title of a Tkinter window?

Easy
47

Which THREE of the following are valid ways to configure a widget's appearance after it has been created?

Medium
48

Which TWO of the following statements correctly describe the behavior of the Tkinter 'pack' geometry manager?

Medium
49

Which THREE of the following are valid ways to pass arguments to a function called by a Tkinter button command?

Hard
50

Which widget is most suitable for displaying multi-line, editable text?

Easy
51

Which attribute of a Button widget controls the text displayed on it?

Easy
52

You need a color chooser dialog in your application. Which module contains this functionality?

Medium
53

Which TWO of the following are valid ways to terminate a Tkinter script gracefully?

Easy
54

What is the primary function of the 'bg' parameter in a widget configuration?

Easy
55

You want to bind a function 'on_click' to a left mouse button click on a Button widget. Which event sequence string is correct?

Medium
56

How do you set a specific font for a widget?

Medium
57

You are developing a Tkinter application that includes a Canvas widget for drawing a dynamic bar chart. The chart data updates every second, and you must redraw the bars. To avoid visual flicker and improve performance, you decide to reuse existing canvas items instead of deleting and recreating them. Which Canvas method should you use to change the height of an existing rectangle item identified by its item ID?

Medium
58

You have a Tkinter Entry widget and want to retrieve the text currently entered by the user. Which method do you call on the Entry instance?

Hard

Frequently asked questions

What does the Graphical User Interface Programming domain cover on the PCPP1 exam?
Be able to instantiate Tk widgets, place them with pack/grid/place, bind events using correct sequence strings, and call Canvas drawing methods with proper coordinates and options. The single most important thing: know exact Tkinter method names, parameter keywords, and event sequence syntax, since questions hinge on precise API details.
How many questions are in this domain?
This page lists all 58 Graphical User Interface Programming questions in the PCPP1 question bank. The actual exam draws from this domain proportionally to its weighting in the official exam blueprint.
What is the best way to practise this domain?
Start with a short focused session (10 questions) to identify gaps, then work through explanations. Repeat with a longer session once the weak areas feel solid.
Can I practise only Graphical User Interface Programming questions?
Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.
Python Institute Certified Professional in Python Programming 1 (PCPP1, PCPP-32-101) (PCPP1) Graphical User Interface Programming Practice Questions