โดย ธวัชชัย แสนหาญ » 15/02/2019 11:20 am
การใช้งาน Python GUI (Tkinter) : Tkinter widget (การแบ่งส่วนของ Frame ด้วย PanedWindow widget)
Frame คือ กรอบหรือหน้าต่าง โดยเราสาามารถแบ่ง Frame ได้ ตามความต้องการ หรือจะแบ่ง ตามลักษณะของ
ข้อมูลเพื่อให้แยกประเภทของการทำงานและเพื่อให้ดูง่ายต่อการทำงานโดยการเขียน จะใช้ โมดูล
Tkinter
ในการออกแบบ Frame โดยมีการเขียนโค้ดดังต่อไปนี้
ส่วนของโค้ดในการสร้างFrame ด้วย PanedWindow widget
โค้ด: เลือกทั้งหมด
from tkinter import *
from tkinter import ttk
mainfrm = Tk()
ttk.Style().configure("s1.TPanedwindow", background="red")
ttk.Style().configure("s2.TPanedwindow", background="green")
pnwleft = ttk.PanedWindow (mainfrm, height=150, width=100, style="s1.TPanedwindow")
pnwleft.pack (side="left")
pnwright = ttk.PanedWindow(mainfrm, height=150, width=100, style="s2.TPanedwindow")
pnwright.pack(side="right")
mainfrm, mainloop()
ผลการรันโปรแกรม
- frame.JPG (12.83 KiB) Viewed 2843 times
ช่องทางศึกษาเพิ่มเติม
เทคนิคการเขียน Python
บทเรียน Python
Programming - C/C++ & java & Python
บทเรียน Python GUI
บทเรียน Python Framework Flask
การใช้งาน Python GUI (Tkinter) : Tkinter widget (การแบ่งส่วนของ Frame ด้วย PanedWindow widget)
Frame คือ กรอบหรือหน้าต่าง โดยเราสาามารถแบ่ง Frame ได้ ตามความต้องการ หรือจะแบ่ง ตามลักษณะของ
ข้อมูลเพื่อให้แยกประเภทของการทำงานและเพื่อให้ดูง่ายต่อการทำงานโดยการเขียน จะใช้ โมดูล [url=https://www.mindphp.com/%E0%B8%9A%E0%B8%97%E0%B9%80%E0%B8%A3%E0%B8%B5%E0%B8%A2%E0%B8%99%E0%B8%AD%E0%B8%AD%E0%B8%99%E0%B9%84%E0%B8%A5%E0%B8%99%E0%B9%8C/83-python/5513-tkinter-python-platform.html]Tkinter[/url]
ในการออกแบบ Frame โดยมีการเขียนโค้ดดังต่อไปนี้
[b]ส่วนของโค้ดในการสร้างFrame ด้วย PanedWindow widget[/b]
[code]from tkinter import *
from tkinter import ttk
mainfrm = Tk()
ttk.Style().configure("s1.TPanedwindow", background="red")
ttk.Style().configure("s2.TPanedwindow", background="green")
pnwleft = ttk.PanedWindow (mainfrm, height=150, width=100, style="s1.TPanedwindow")
pnwleft.pack (side="left")
pnwright = ttk.PanedWindow(mainfrm, height=150, width=100, style="s2.TPanedwindow")
pnwright.pack(side="right")
mainfrm, mainloop()[/code]
ผลการรันโปรแกรม
[attachment=0]frame.JPG[/attachment]
[b]ช่องทางศึกษาเพิ่มเติม[/b] :baa:
[url=https://www.mindphp.com/developer/tips-python.html]เทคนิคการเขียน Python[/url]
[url=https://www.mindphp.com/%E0%B8%9A%E0%B8%97%E0%B9%80%E0%B8%A3%E0%B8%B5%E0%B8%A2%E0%B8%99%E0%B8%AD%E0%B8%AD%E0%B8%99%E0%B9%84%E0%B8%A5%E0%B8%99%E0%B9%8C/83-python.html]บทเรียน Python[/url]
[url=https://www.mindphp.com/forums/viewforum.php?f=16]Programming - C/C++ & java & Python[/url]
[url=https://www.mindphp.com/%E0%B8%9A%E0%B8%97%E0%B9%80%E0%B8%A3%E0%B8%B5%E0%B8%A2%E0%B8%99%E0%B8%AD%E0%B8%AD%E0%B8%99%E0%B9%84%E0%B8%A5%E0%B8%99%E0%B9%8C/python-gui.html]บทเรียน Python GUI[/url]
[url=https://www.mindphp.com/%E0%B8%9A%E0%B8%97%E0%B9%80%E0%B8%A3%E0%B8%B5%E0%B8%A2%E0%B8%99%E0%B8%AD%E0%B8%AD%E0%B8%99%E0%B9%84%E0%B8%A5%E0%B8%99%E0%B9%8C/python-framework-flask.html]บทเรียน Python Framework Flask[/url]