หน้า 1 จากทั้งหมด 1

การใช้งาน Python GUI (Tkinter) : การ Browse file (การค้นหาไฟล์)

โพสต์แล้ว: 22/02/2018 5:16 pm
โดย Jom07
การใช้งาน Python GUI (Tkinter) : การ Browse file (การค้นหาไฟล์)
เป็นการ browse หาไฟล์ที่ต้องการเรียกใช้งาน

ตัวอย่าง

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

from tkinter import filedialog
from tkinter import *

root = Tk()
root.filename = filedialog.askopenfilename(initialdir = "/",title = "Select file",filetypes = (("files","*.exe"),("all files","*.*")))
print (root.filename)
ผลรัน
รูปภาพ
เมื่อกดรันจะมีหน้าต่างขึ้นมาให้เราค้นหาไฟล์