0% found this document useful (0 votes)
4 views

Python28

Python

Uploaded by

shruticpatil07
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Python28

Python

Uploaded by

shruticpatil07
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Practical No.

28

1. Explain various Tkinter widgets available in Python


Answer :
Tkinter provides several built-in widgets to design graphical user interfaces. Some
commonly used widgets are:
 Label: Used to display text or images.
 Button: Creates a clickable button to perform an action.
 Entry: A single-line text box to accept user input.
 Checkbutton: Displays a checkbox for multiple options.
 Radiobutton: Allows the user to select one option from a group.
 Listbox: Displays a list of items from which users can select.
 Menu: Creates a menu bar with dropdown options.
 Scrollbar: Adds scrollbars to widgets like Text or Listbox.

2. Write a Python program using Tkinter that creates a CheckButton.


PROGRAM :
import tkinter as tk
root = tk.Tk()
root.title("Checkbutton Example")
check_var = tk.IntVar()
check_button = tk.Checkbutton(root, text="I agree", variable=check_var)
check_button.pack()
root.mainloop()

OUTPUT :

3. Write a Python program using Tkinter that creates a RadioButton.


PROGRAM :

import tkinter as tk
root = tk.Tk()
root.title("Tkinter Title")
root.mainloop()
OUTPUT :

4. Write a Python program using Tkinter that creates a Menu.


PROGRAM :

import tkinter as tk

root = tk.Tk()
root.title("Menu Example")
menu_bar = tk.Menu(root)
menu = tk.Menu(menu_bar)
menu.add_command(label="Open")
menu.add_command(label="Save")
menu.add_separator()
menu.add_command(label="Exit")
menu_bar.add_cascade(label="File", menu=menu)
root.config(menu=menu_bar)

root.mainloop()

OUTPUT :

You might also like