Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- import tkinter as tk
- from tkinter import ttk
- ventana = tk.Tk()
- ventana.title("Mi primera app")
- ventana.config(width=400, height=800)
- def seleccionar_lista():
- seleccion = lista.get(lista.curselection())
- print(seleccion)
- def seleccionar_combo():
- print(combo.get())
- # imagen dentro de una etiqueta
- mi_imagen = tk.PhotoImage(file="camion.png")
- label = ttk.Label(image=mi_imagen)
- label.place(relx=0.5, rely=0.5, relwidth=0.50, relheight=0.50)
- # lista
- lista = tk.Listbox()
- lista.insert(0,"Python", "C", "Java")
- lista.place(x=10, y=100)
- boton = ttk.Button(text="Seleccionar", command=seleccionar_lista)
- boton.place(x=10, y=270)
- # lista desplegable (combobox)
- combo = ttk.Combobox(state="readonly", values=["1 Bs As",2,3,4,5])
- combo.place(x=10, y=300)
- boton = ttk.Button(text="Seleccionar", command=seleccionar_combo)
- boton.place(x=10, y=330)
- # casilla de verificación
- estado = tk.BooleanVar()
- estado.set("False")
- casilla = ttk.Checkbutton(text="Acepto los términos y condiciones", variable=estado)
- casilla.place(x=10, y=380)
- # barra de progreso
- barra = ttk.Progressbar(maximum=100)
- barra.place(x=10, y=450, width=200)
- barra.step(99.9)
- barra.start(30)
- barra = ttk.Progressbar(orient=tk.VERTICAL, maximum=100)
- barra.place(x=300, y=450, height=200)
- barra.step(99.9)
- barra.start(30)
- ventana.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement