การใช้งาน Python GUI (Tkinter) : ปุ่มปิดหน้าต่างโปรแกรม

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: การใช้งาน Python GUI (Tkinter) : ปุ่มปิดหน้าต่างโปรแกรม

การใช้งาน Python GUI (Tkinter) : ปุ่มปิดหน้าต่างโปรแกรม

โดย Jom07 » 26/02/2018 3:14 pm

การใช้งาน Python GUI (Tkinter) : การทำ ปุ่มปิดโปรแกรม เป็นการสร้างปุ่มและสร้างปุ่มปิดโปรแกรมขึ้นมา เช่น

ตัวอย่าง

โค้ด: เลือกทั้งหมด

from  tkinter import *

root = Tk()
root.title("Tk Close")
exitButton= Button(root,text="Close", command=root.destroy).pack()

root.geometry("220x200")
root.mainloop()
ผลรัน

รูปภาพ

เมื่อกดปุ่มจะทำการปิดหน้าต่างทันที

ข้างบน