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.
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.
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?
Hard2A 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?
Hard3Which TWO of the following events are commonly bound in Tkinter for mouse interaction?
Medium4When using the place() geometry manager, what is the purpose of 'relx' and 'rely'?
Hard5You 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?
Medium6Which TWO of the following are valid ways to add padding to a widget in the grid layout?
Hard7You 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?
Hard8You 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?
Hard9A 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?
Medium10A 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?
Medium11How do you access the value of a StringVar associated with an Entry widget?
Hard12You 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?
Hard13You 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?
Medium14You need to add a label that displays static text in your GUI. Which widget is most appropriate for this purpose?
Easy15You 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?
Easy16You wish to group several widgets together within a frame. Which widget acts as a container for this purpose?
Medium17You 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?
Easy18You 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.)
Medium19You 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?
Easy20You have a Checkbutton and you need to track its state. What is the recommended way to associate a variable with the Checkbutton?
Medium21A 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?
Hard22When using the grid layout manager, which option allows a column to grow when the window is resized?
Hard23You 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.)
Hard24You 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?
Hard25You 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?
Hard26You 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?
Medium27You have a list of options and want the user to select one using a dropdown menu. Which widget should you use?
Medium28Which THREE of the following are valid parameters for the pack() layout manager?
Medium29You 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?
Medium30Which widget is most appropriate for displaying a list of selectable items?
Medium31A 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?
Easy32Which TWO of the following are valid geometry managers in Tkinter?
Easy33A 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?
Hard34You 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?
Medium35You 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.)
Hard36You 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?
Medium37Which THREE of the following widgets are part of the 'ttk' (Themed Tkinter) module?
Hard38Which module must be imported to utilize Tkinter in a Python script?
Easy39You 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?
Easy40You 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?
Easy41You 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?
Medium42You 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?
Easy43You 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?
Medium44You 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?
Hard45In a Tkinter grid layout, you want a button to span across two columns. Which parameter should you use?
Medium46What is the correct way to specify the title of a Tkinter window?
Easy47Which THREE of the following are valid ways to configure a widget's appearance after it has been created?
Medium48Which TWO of the following statements correctly describe the behavior of the Tkinter 'pack' geometry manager?
Medium49Which THREE of the following are valid ways to pass arguments to a function called by a Tkinter button command?
Hard50Which widget is most suitable for displaying multi-line, editable text?
Easy51Which attribute of a Button widget controls the text displayed on it?
Easy52You need a color chooser dialog in your application. Which module contains this functionality?
Medium53Which TWO of the following are valid ways to terminate a Tkinter script gracefully?
Easy54What is the primary function of the 'bg' parameter in a widget configuration?
Easy55You want to bind a function 'on_click' to a left mouse button click on a Button widget. Which event sequence string is correct?
Medium56How do you set a specific font for a widget?
Medium57You 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?
Medium58You 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?
HardOther domains
All PCPP1 exam domains
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.