PCPP1 practice question 5 of 10
If w is a correctly created main application window, which method would you use to foe both of the main window's dimensions?
Full set: 45 questionsThe resizable() method is used to control whether a tkinter main window or Toplevel window can be resized by the user. To fix both the width and height, you would call the method with two False arguments, like w.resizable(width=False, height=False). The first argument controls horizontal resizing, and the second controls vertical resizing. Setting them to False (or 0) disables the user's ability to change the window's dimensions, effectively fixing its size.
A. w.fixshape(): This is not a valid method in the standard tkinter library for controlling window dimensions or resizability.
B. w.fixdim(): This method does not exist in the tkinter API. It is a fabricated name.
D. w.makewindow(): This is not a standard tkinter method for creating or modifying window properties like resizability.
1. Official Python Documentation: The tkinter documentation describes the resizable() method for Tk and Toplevel widgets. It states, "This method is used to control whether the window can be resized or not. w.resizable(width=False, height=False) makes the window non-resizable."
Source: Python Software Foundation, tkinter — Python interface to Tcl/Tk, Section 27.1.1.1. Window Manager Methods. Available at: https://docs.python.org/3/library/tkinter.html#window-manager-methods
2. University Courseware: Course materials from reputable computer science programs often cover tkinter basics. For example, materials on GUI programming explain that resizable(False, False) is the standard way to make a window's size fixed.
Source: New Mexico Tech, CS 107 - GUI Programming with Tkinter, Page 10. "To prevent a window from being resized, use the resizable method: window.resizable(width=FALSE, height=FALSE)". Available at: http://infohost.nmt.edu/~shipman/doc/tkinter/tkinter.pdf
3. Academic Resource: An introduction to programming using Python from Michigan State University's Department of Computer Science and Engineering details the use of tkinter methods.
Source: Punch, W. F., & Enbody, R. J. (2017). The Practice of Computing Using Python. Michigan State University, Chapter 11: Graphical User Interfaces, Section 11.3.2, Page 498. The text describes basic widget properties, including making a window non-resizable with win.resizable(0,0).
Keep practicing
Take the free PCPP1 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other PCPP1 practice questions
- Question 1Select the true statements about the connection-oriented and connectionless types of comm…
- Question 2Select the true statements about the sqlite3 module. (Select two answers.)
- Question 4Select the true statements about the sqirte3 module. (Select two answers.)
- Question 7Select the true statements about the json.-dumps () function. (Select two answers.)
- Question 9Select the true statements related to PEP 8 naming conventions. (Select two answers.)
- Question 10Select the true statement related to PEP 257.
