โดย Jom07 » 05/03/2018 6:16 pm
การใช้งาน Python GUI (Tkinter) : Scrollbar Widget (วิดเจ็ตสเปรดชีต) เป็นการกำหนดค่า แล้วค่าที่ได้จะออกอัตโนมัติ เช่น
ตัวอย่าง
โค้ด: เลือกทั้งหมด
from Tkinter import *
root =Tk()
root.title("Scrollbar")
scroll = Scrollbar(root)
scroll.pack(side = RIGHT,fill=Y)
list1 = Listbox(root,yscrollcommand=scroll.set)
for line in range(10):
list1.insert(END, "number" + str(line))
list1.pack(side=LEFT,fill=BOTH)
scroll.config(command=list1.yview)
mainloop()
ผลรัน
การใช้งาน Python GUI (Tkinter) : Scrollbar Widget (วิดเจ็ตสเปรดชีต) เป็นการกำหนดค่า แล้วค่าที่ได้จะออกอัตโนมัติ เช่น
[b]ตัวอย่าง[/b]
[code]from Tkinter import *
root =Tk()
root.title("Scrollbar")
scroll = Scrollbar(root)
scroll.pack(side = RIGHT,fill=Y)
list1 = Listbox(root,yscrollcommand=scroll.set)
for line in range(10):
list1.insert(END, "number" + str(line))
list1.pack(side=LEFT,fill=BOTH)
scroll.config(command=list1.yview)
mainloop()
[/code]
[b]ผลรัน[/b]
[img]http://snap.mindphp.com/index.php?view=2018Mar05_5a9d24279dd86[/img]