import tkinter as tk root = tk.Tk() label = tk.Label(root, text="Hello, World!", font=("Arial", 20)) label.pack() root.mainloop()
import tkinter as tk from PIL import ImageTk, Image root = tk.Tk() image = Image.open("example.png") photo = ImageTk.PhotoImage(image) label = tk.Label(root, image=photo) label.pack() root.mainloop()In this example, we create a new tkinter window and add a Label widget to display an image. We use the PIL (Python Imaging Library) package to load an image from a file and create a PhotoImage object that can be used by the Label widget. In conclusion, the package library used in these examples is tkinter, a built-in Python library for creating GUI applications.