PCPP 32 10x PCPP Certified Professional Python Programmer 1 · Free Practice Question Easy
Question 24
In Tkinter, which of the following statements is true about the StringVar class?
-
A
StringVaris a class used for creating spinbox widgets. -
B
StringVaris used to create non-editable text displays. -
C
StringVaris a class that provides variable services for Tkinter entry widgets. -
D
StringVaris used for error handling in Tkinter.
Reveal correct answer
Correct answer: C
A.
StringVar is not specifically used for creating spinbox widgets. Spinbox is another widget in Tkinter, but StringVar can be used as a variable to hold its value.
B.
StringVar is not used for creating non-editable text displays. For that purpose, Tkinter provides the Label widget.
C.
StringVar is a class in Tkinter used to manipulate string values of Tkinter variables, especially for widgets like Entry and Label, where text can change dynamically.
D.
StringVar is not used for error handling in Tkinter. Python's standard error handling mechanisms like try and except are used for error handling.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
