import tkinter as tk root = tk.Tk() # create label widget label = tk.Label(root, text='Hello World', font=('Arial', 14)) # configure label properties label.config(text='Welcome', font=('Helvetica', 20)) label.pack() root.mainloop()
import tkinter as tk root = tk.Tk() # create label widget label = tk.Label(root, text='Python GUI Programming') # configure label properties label.config(bg='black', fg='white') label.pack() root.mainloop()In this example, we create a label widget with the text 'Python GUI Programming'. Then we use the configure method to change the background color to 'black' and foreground color to 'white'. The final output will show the updated label on the tkinter window. Python tkinter is a standard Python library used for creating GUI applications.