|
|
发表于 2018-2-9 21:28:35
|
显示全部楼层
那可以的啊,你只要放好Frame就好了,此时Frame相当于一个容器,容器内的东西摆放位置与这个容器本身有关。
举个栗子:
- from tkinter import *
- root = Tk()
- root.geometry("80x80")
- F1 = Frame(root,height=2)
- F2 = Frame(root,height=2)
- F3 = Frame(root,height=2)
- F4 = Frame(root,height=2)
- btn1 = Button(F1, text="1").pack()
- btn2 = Button(F2, text="1").pack()
- btn3 = Button(F3, text="1").pack()
- btn4 = Button(F4, text="1").pack()
- F1.grid(row=0,padx=2,pady=2)
- F2.grid(row=0,column=1,padx=2,pady=2)
- F3.grid(row=1,column=0,padx=2,pady=2)
- F4.grid(row=1,column=1,padx=2,pady=2)
- mainloop()
复制代码 |
|