โดย ธวัชชัย แสนหาญ » 13/02/2019 6:48 pm
การใช้งาน Python GUI (Tkinter) : Tkinter widget (Cursors)การแสดงผลตัวชี้เมาส์บน
การแสดงผลตัวชี้เมาส์บน widget (Cursors)
โดยปกติตัวชี้เมาส์หรือเคอร์เซอร์ (cursors) จะเป็นหัวลูกศรสีขาวเมื่อนําไปวางบน widget เราสามารถ ที่จะเปลี่ยน
ตัวชี้เมาส์ได้ด้วยการเรียกใช้งานออปชั่น Cursor แล้วตามด้วยชื่อตัวชี้เมาส์ ซึ่งจะทําให้ตัวชี้เมาส์ เปลี่ยนไปตามที่
เรากําหนด เมื่อนําไปวางบน widget
ตัวอย่าง การกําหนดตัวชี้เมาส์บน Button widget
โค้ด: เลือกทั้งหมด
from tkinter import *
from tkinter import ttk
mainfrm = Tk()
ttk.Frame (height=80, width=200).pack()
ttk.Button (mainfrm, text="Enter", cursor="mouse").place (x=10,y= 30)
ttk.Button (mainfrm, text="Cencle", cursor="x_cursor").place (x=100, y=30)
mainfrm. mainloop()
- 7198.jpg (24.55 KiB) Viewed 3364 times
- 7199.jpg (25.92 KiB) Viewed 3364 times
บทเรียน Python
VDO Tutorial - Python
บทเรียน Python Tensorflow
บทเรียน Python GUI
การใช้งาน Python GUI
[b]การใช้งาน Python GUI (Tkinter) : Tkinter widget (Cursors)การแสดงผลตัวชี้เมาส์บน[/b]
การแสดงผลตัวชี้เมาส์บน widget (Cursors)
โดยปกติตัวชี้เมาส์หรือเคอร์เซอร์ (cursors) จะเป็นหัวลูกศรสีขาวเมื่อนําไปวางบน widget เราสามารถ ที่จะเปลี่ยน
ตัวชี้เมาส์ได้ด้วยการเรียกใช้งานออปชั่น Cursor แล้วตามด้วยชื่อตัวชี้เมาส์ ซึ่งจะทําให้ตัวชี้เมาส์ เปลี่ยนไปตามที่
เรากําหนด เมื่อนําไปวางบน widget
ตัวอย่าง การกําหนดตัวชี้เมาส์บน Button widget
[code]from tkinter import *
from tkinter import ttk
mainfrm = Tk()
ttk.Frame (height=80, width=200).pack()
ttk.Button (mainfrm, text="Enter", cursor="mouse").place (x=10,y= 30)
ttk.Button (mainfrm, text="Cencle", cursor="x_cursor").place (x=100, y=30)
mainfrm. mainloop()[/code]
[attachment=0]7199.jpg[/attachment]
[attachment=1]7198.jpg[/attachment]
[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://mindphp.com/vdo-tutorial-python.html]VDO Tutorial - 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-php/246-python-tensorflow.html]บทเรียน Python Tensorflow[/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-php/245-python-gui.html]บทเรียน Python GUI[/url]
[url=https://www.mindphp.com/forums/viewtopic.php?f=144&t=46338]การใช้งาน Python GUI[/url]