跳转到我的博客
在主窗口root中放置三个容器用于容纳组件,容器采用框架设计。
import tkinter as tk
root = tk.Tk()
root.geometry('800x600+200+200')
root.title('学习框架')
frame1 = tk.Frame(root, bd=2, relief=tk.RAISED)
frame1.config(bg='#FFB6C1', height=40, width=760)
frame2 = tk.Frame(root, bd=2, relief=tk.RAISED)
frame2.config(bg='#00BFFF', height=500, width=150)
frame3 = tk.Frame(root, bd=2, relief=tk.RAISED)
frame3.config(bg='#8B008B', height=500, width=600)
frame1.place(x=20, y=5)
frame2.place(x=20, y=50)
frame3.place(x=180, y=50)
root.mainloop()