wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python GUI

Total questions: 20

Worksheet time: 8mins

Name
Class
Date
1.

How do you create a Label widget in Tkinter?

a)

label = Label("Hello")

b)

label = Label(text="Hello")

c)

Label.new("Hello")

d)

 create_Label("Hello")

2.

What is the command to create a basic window in tkinter?

a)

create_window()

b)

 window = tk.Tk()

c)

window = BasicWindow()

d)

 window.create()

3.

What is the function of the pack() method in Tkinter?

a)

Organizing widgets in a grid

b)

Organizing widgets in blocks before placing them in the parent widget

c)

Placing widgets on specific positions in the window

d)

Organizing the layout of multiple windows

4.

What is the purpose of creating Frame widgets in a Tkinter application?

a)

To add decorative images

b)

To group related widgets or provide padding

c)

To control the application flow

d)

To set text color schemes

5.

Which widget is used to display text or images that cannot be edited by the user in Tkinter?

a)

Button

b)

Entry

c)

Text

d)

Label

6.

Which geometry manager is commonly used in Tkinter for organizing widgets?

a)

Place

b)

Grid

c)

Pack

d)

Layout

7.

What is a widget in the context of graphical user interfaces (GUIs)?

a)

A small furry creature that lives on the desktop.

b)

An element or component that users can interact with to perform tasks or access information in a GUI application.

c)

A tool used by developers to debug GUI code.

d)

A virtual container for storing data in a GUI application.

8.

Which widget is commonly used to trigger actions when clicked in Tkinter?

a)

Entry

b)

Label

c)

Button

d)

Frame

9.

What is the purpose of the update_clock() function when creating a digital clock?

a)

It sets the title of the Tkinter window to "Digital Clock".

b)

It retrieves the current time and updates the text of the clock_label widget every second.

c)

It creates a new Label widget named clock_label with a font size of 50.

d)

It initializes the Tkinter event loop and starts the application.

10.

Which is the correct way to use tkinter in python

program?

a)

include tkinter *

b)

import tkinter *

c)

from tkinter import *

d)

from tkinter include *

11.

Which of the following function used to create window in

python tkinter.

a)

window()

b)

tk()

c)

toolkit()

d)

wd()

12.

Which of the following attribute used to change the

background color of a Label widget in python tkinter

a)

background

b)

bg

c)

fg

d)

foreground

13.

Choose the correct statement to display title.

a)

window.title("My First Program")

b)

window.title(My First Program)

c)

window.title "My First Program"

d)

title.window("My First Program")

14.

what is the correct execution of the code as seen in the picture?

a)

def clicked():

lbl.configure(text="Button was clicked !!")

b)

def pindot(): lbl.configure(text="Button was clicked !!")

c)

def clicked(): lbl.configurate(text="Button was clicked !!")

d)

def clicked(): button.configure(text="Button was clicked !!")

15.

what is the correct execution of the code as seen in the picture?

a)

lbl = label(window, text="Hello")

b)

lbl = Label(window, text="Hello")

c)

lbl = Text(window, text="Hello")

d)

lbl = txt(window, text="Hello")

16.

what is the widget been programmed?

a)

radiobutton

b)

selectbox

c)

combobox

d)

checkbox

17.

what is the widget been programmed?

a)

radiobutton

b)

button

c)

combobox

d)

checkbox

18.

what is the widget been programmed?

a)

message box

b)

info message

c)

alert box

d)

message content

19.

what is the correct code for the picture?

a)

btn = Button(window, text="Click Me", bg="org", fg="rd")

b)

btn = Button(window, text="Click Me", bg="blue", fg="red")

c)

btn = Button(window, text="Click Me", bg="orange", fg="red")

d)

btn = Button(window, text="Click Me", bg="red", fg="orange")

20.

what is the widget been programmed?

a)

Entry

b)

Canvas

c)

Relief Style

d)

Bitmaps