WorksheetsPython GUI/Files Quiz
Total questions: 10
Worksheet time: 5mins
Which library is most commontly used for GUI development in python
PyQt
Tkinter
kivy
Pygame
What is the main widget in Tkinter used to display text to the user
Label
Button
Entry
Text
Which method is used to enter the main event loop in tkinter
Start()
run()
mainloop()
begin()
How do you create a button in Tkiter?
Button(root,text="clicck me",command=some_function)
button(root,text="Clcik me")
Tk.Button(root)
CreateButton(root)
What does the pack() method in Tkinter do?
Centres the widgets in the window
Sets the widget's size
Places widgets in the window sequentially
Deletes widgets
What will the following code output when executed?
A button that changes the label to "Button Clicked!" when pressed
An error: command is not a valid argument
A window with "Hello, World!" displayed, but the button does nothing
No output as the GUI will not appear
What will the following code output?
An error because the file is not closed
Hello, World!
No output
FileNotFoundError
Which mode is used to open a file and add content on it?
w
r
a
w+
What happens if you open a file in w mode and the file already exists?
An error is raised
The file is appended
The file is overwritten
The file is read-only
What should replace X in the code below to save the text entered in the Entry widget into a new file?
r
w
x
a
