1. 程式人生 > >Python 圖形界面元素

Python 圖形界面元素

cati click let man geo main ext focus 路徑

from tkinter import *
import os

def button_click1():
    try:
        filePath = rD:\MyDocument\Programs\Python\oprate_file_system
        #打開指定路徑
        os.system("explorer.exe %s"%filePath)
        app.destroy()
    except Exception as ex:
        print(ex)
app = Tk()
app.title("Your tkinter application
") app.geometry(300x100+200+100) b1 = Button(app,text = "study place",width = 10,command = button_click1) b1.pack(side = left,padx = 10,pady = 10) app.protocol("WM_DELETE_WINDOW",button_click1) #app.protocol("WM_SAVE_YOURSELF",button_click1) #app.protocol("WM_TAKE_FOCUS",button_click1) app.mainloop()

Python 圖形界面元素