In this article, I will explain the use of label in Python. I am adding tkinter to my form. In the Title section, I enter a title in the form. The text that will appear on the label is written in the text part of the label. The background color of the Label object is determined by bg, and the text color is determined by fg. The font property defines the font and font size. The place of the label in the form is determined with padx and pady.
Figure 1
pyton_label.py
import tkinter as tk
root = tk.Tk()
root.title("label..bs")
str1="Life is like riding a bicycle,To keep your balance,You must keep moving -Albert Einstein"
lbl = tk.Label(root, text=str1, bg="black", fg="white",font=('arial',12,'normal'))
lbl.pack(fill=tk.X, padx=20,pady=10)
tk.mainloop()
I have come to the end of this article. See you in my next article. Happy coding. Bahadir Sahin
No comments:
Post a Comment