You've already forked Curso-lenguaje-python
Add library exercises
This commit is contained in:
23
python-ofensivo/08_librerias/08_tkinter_09_filedialog.py
Normal file
23
python-ofensivo/08_librerias/08_tkinter_09_filedialog.py
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Librería tkinter - filedialog
|
||||
|
||||
"""
|
||||
|
||||
import tkinter as tk
|
||||
from tkinter import filedialog as fd
|
||||
|
||||
|
||||
def abrir_archivo():
|
||||
ruta_archivo = fd.askopenfilename()
|
||||
print(f"[+] Ruta del archivo seleccionado: {ruta_archivo}")
|
||||
|
||||
|
||||
root = tk.Tk()
|
||||
root.geometry("150x80")
|
||||
root.title("Button() Widget & messagebox")
|
||||
|
||||
boton = tk.Button(root, text="Abrir archivo", command=abrir_archivo)
|
||||
boton.pack(pady=10)
|
||||
|
||||
root.mainloop()
|
||||
Reference in New Issue
Block a user