Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

add button to python gui file


import tkinter as tk
from tkinter import filedialog

def UploadAction(event=None):
    filename = filedialog.askopenfilename()
    print('Selected:', filename)

root = tk.Tk()
button = tk.Button(root, text='Open', command=UploadAction)
button.pack()

root.mainloop()

Source by w3programmers.org #
 
PREVIOUS NEXT
Tagged: #add #button #python #gui #file
ADD COMMENT
Topic
Name
5+3 =