Here we are providing basic tutorial in Tkinter required by a beginner python developer. This topic explains about a widget called as labels.

Code

from tkinter import *

root=Tk()

theLabel = Label(root, text="This is tkinter!!")
theLabel.pack()

root.mainloop()

First few lines of the code is explained in Introduction. In this code, we created a label theLabel by using method Label, method is passed the root window and text that must appear on the label.

Output

output


Consider this sample code also


from tkinter import *

root=Tk()

theLabel = Label(root, text="This is tkinter!!")
theLabel.pack()

theLabell = Label(root, text="This is also tkinter!!")
theLabell.pack()

root.mainloop()


Output

output