A red frame fills the window.
There is one label inside the frame. Both the frame and label use pack geometry manager, rather than grid or absolute positioning with place.
The label text is 'Hello World' in big letters. We use a red background to match the frame background.
# tk2.py
from tkinter import *
root = Tk()
root.title('Welcome')
root.geometry('500x500')
frame = Frame(root)
frame['bg']='red'
frame.pack(expand = True, fill = BOTH)
label = Label(frame, text = 'Hello World!', bg = "red",
font=("Helvetica", 64))
label.pack(side = RIGHT)
root.mainloop()
Output:
No comments:
Post a Comment