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
- def guardar_lista():
- nombre = lista.get(lista.curselection())
- print(nombre)
- def guardar_combo():
- nombre = combo.get()
- print(nombre)
- ventana = tk.Tk()
- ventana.title("Posicionamiento Place")
- ventana.config(width=600, height=800, bg="peru")
- # lista desplegada (listbox)
- lista = tk.Listbox()
- lista.insert(0,"Ana","Tito","Juana","Carmen","Roberto")
- lista.place(x=10, y=50, width=100, height=100)
- boton = ttk.Button(text="Guardar", command=guardar_lista)
- boton.place(x=20, y=170)
- # lista desplegable (combobox)
- combo = ttk.Combobox(state="readonly",values=["C++","Python","Java","PHP"])
- combo.place(x=20, y=250)
- boton = ttk.Button(text="Guardar", command=guardar_combo)
- boton.place(x=20, y=300)
- # imagen (dentro de una etiqueta)
- imagen = tk.PhotoImage(file="camion.png")
- label = ttk.Label(image=imagen)
- label.place(relx=0.5, rely=0.5, relwidth=0.5, relheight=0.5)
- # casilla de verificación
- estado = tk.BooleanVar()
- estado.set("True")
- casilla = ttk.Checkbutton(text="Acepto los términos y condiciones",variable=estado)
- casilla.place(x=20, y=360)
- # barras 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(maximum=100, orient=tk.VERTICAL)
- barra.place(x=270, y=450, height=200)
- barra.step(99.9)
- barra.start(30)
- ventana.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement