Python GUI libraries

Last Updated :
Discuss
Comments

Question 1

Which GUI toolkit is included with Python and is known for being simple and beginner-friendly?

  • A

    PyQt

  • B

    PyQt

  • C

    Tkinter

  • D

    PyGTK

Question 2

Which method in Tkinter is used to keep the window running until it's closed by the user?

  • A

    start()

  • B

    wait()

  • C

    mainloop()

  • D

    show()

Question 3

What will the following code print when the button is clicked?

Python
from tkinter import *
root = Tk()
lbl = Label(root, text = "Hello")
lbl.grid()

def clicked():
    lbl.configure(text = "Clicked")

btn = Button(root, text = "Click", command = clicked)
btn.grid()
root.mainloop()


  • A

    Prints “Hello” forever

  • B

    Updates the label to “Clicked” when button is clicked

  • C

    Throws an error

  • D

    Closes the window

Question 4

Which of these is NOT a valid widget in Tkinter?

  • A

    Entry

  • B

    Menu

  • C

    RadioButton

  • D

    Chart

Question 5

What is the correct syntax to add a menu labeled “File” in Tkinter?

  • A

    root.menu("File")

  • B

    Menu.add("File")

  • C

    menu.add_cascade(label='File', menu=item)

  • D

    menu.add_command('File')

Question 6

Which Tkinter geometry manager places widgets in a grid format like a table?

  • A

    place()

  • B

    organize()

  • C

    grid()

  • D

    pack()

Question 7

What does the Entry() widget do in Tkinter?

  • A

    Displays a multiline text area

  • B

    Adds a menu button

  • C

    Allows user input in a single-line textbox

  • D

    Creates a dropdown menu

Question 8

Which of the following GUI libraries is best suited for building cross-platform mobile apps with multi-touch support?

  • A

    PyQt

  • B

    Tkinter

  • C

    Kivy

  • D

    Streamlit

Question 9

What is the output of this code?

Python
from tkinter import *
root = Tk()
txt = Entry(root)
txt.grid()
txt.insert(0, "Geeks")
print(txt.get())


  • A

    Nothing, unless user types

  • B

    Geeks

  • C

    Error

  • D

    None

Question 10

What’s the role of the geometry() method in a Tkinter window?

  • A

    Closes the window

  • B

    Sets the title

  • C

    Defines the size of the window

  • D

    Adds widgets

There are 10 questions to complete.

Take a part in the ongoing discussion