31. How do you add a tooltip to a widget in Tkinter? A. widget.add_tooltip("Tooltip text") B. Tooltip(widget, text="Tooltip text") C. widget.tooltip("Tooltip text") D. add_tooltip(widget, "Tooltip text") Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B Solution: The Tooltip(widget, text="Tooltip text") method is used to add a tooltip to a widget in Tkinter.
32. What is the purpose of the Canvas widget in Tkinter? A. Displaying images B. Drawing graphics and shapes C. Playing audio D. Handling user input Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B Solution: The Canvas widget is used for drawing graphics, shapes, and images in Tkinter.
33. How do you change the background color of a widget in Tkinter? A. background_color.set("NewColor") B. widget.bg_color("NewColor") C. widget.configure(bg="NewColor") D. widget.set_bg("NewColor") Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C Solution: The widget.configure(bg="NewColor") method is used to change the background color of a widget in Tkinter.
34. What is the purpose of the PhotoImage class in Tkinter? A. Handling user input B. Displaying images C. Drawing graphics D. Creating message boxes Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B Solution: The PhotoImage class is used for displaying images in Tkinter.
35. How do you create a tooltip for a widget using the Label widget in Tkinter? A. Label(text="Tooltip text") B. TooltipLabel(text="Tooltip text") C. Label(tooltip="Tooltip text") D. Label(widget, text="Tooltip text") Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D Solution: You can create a tooltip for a widget using the Label(widget, text="Tooltip text") syntax in Tkinter.