from tkinter import *
window = Tk()
window.title("Tkinter tutorial 2")
window.geometry("250x250")
# Adding a label to your window
name_label = Label(window, text="Name: ")
name_label.pack(anchor="w")
# Adding an entry to your window
name_entry = Entry(window)
name_entry.pack(anchor="w")
"""
anchor = Anchors are used to define where text is positioned relative to a reference point.
Here is list of possible constants, which can be used for Anchor attribute.
NW
N
NE
W
CENTER
E
SW
S
SE
"""
window.mainloop()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter