Ejemplo 1: interfaz gráfica de usuario básica de tkinter
import tkinter as tk
root = tk.Tk()
root.title("my title")
root.geometry('200x150')
root.configure(background='black')
# enter widgets here
root.mainloop()
Ejemplo 2: interfaz gráfica de usuario en tkinter
from tkinter import *
import os
# window
window = Tk()
window.geometry("450x450")
window.title("Gui App")
window.configure(bg="powder blue")
# Enter or user input in tkinter
filename = Entry(window, width=75)
filename.pack()
# Run file Function
def runFile():
try:
os.startfile(filename.get())
except:
error = Label(window, text=f"No file found as {filename.get}")
error.pack()
# Run file button
open_file_button = Button(window, text="Run File", command=runFile)
open_file_button.pack()
window.mainloop()
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)