การใช้งาน Python GUI (Tkinter) : Grid (กำหนดตำแหน่ง grid)
Posted: 01/03/2018 2:15 pm
การใช้งาน Python GUI (Tkinter) : Grid (กำหนดตำแหน่ง grid) เป็นการกำหนดตำแหน่งไม่ว่าจะเป็นปุ่ม ตัวหนังสือ หรือช่องใช่ข้อมูลสามารถกำหนดตำแหน่งโดยใช้ Grid เช่น
ตัวอย่าง
ผลรัน

ตัวอย่าง
Code: Select all
from tkinter import *
root = Tk()
root.title('Grid')
lable_1 = Label(root, text="Name")
lable_2 = Label(root, text="Password")
entry_1 = Entry(root)
entry_2 = Entry(root)
lable_1.grid(row=0)
lable_2.grid(row=1)
entry_1.grid(row=0, column=1)
entry_2.grid(row=1, column=1)
root.mainloop()