tkinter pack and place

pack and place 放置位置

需求:

import tkinter as tk
import tkinter.messagebox
window = tk.Tk()
window.title('my window')
window.geometry('200x200')
#  1.
# tk.Label(window,text=1).pack(side='top')
# tk.Label(window,text=1).pack(side='bottom')
# tk.Label(window,text=1).pack(side='left')
# tk.Label(window,text=1).pack(side='right')
#  2.
for i in range(4):
    for j in range(3):
        tk.Label(window,text=1).grid(row =i,column=j,padx=10,pady=10)

#  3.
#tk.Label(window,text=1).place(x=10,y=100,anchor = 'nw')

window.mainloop()

猜你喜欢

转载自blog.csdn.net/qq_18668137/article/details/86152490
今日推荐