Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- # metodo place
- def leer_lista():
- nombre = lista.get(lista.curselection())
- print(nombre)
- def leer_combo():
- numero = int(combobox.get())
- print(numero)
- print(type(numero))
- import tkinter as tk
- from tkinter import ttk
- ventana = tk.Tk()
- ventana.title("Formulario")
- ventana.config(width=400, height=800)
- # imagen dentro de una etiqueta
- imagen_camion = tk.PhotoImage(file="camion.png")
- etiqueta = ttk.Label(image = imagen_camion)
- etiqueta.place(relx=0.5, rely=0.5, relwidth=0.5, relheight=0.5)
- # lista fija
- lista = tk.Listbox()
- lista.insert(0,"Alejandro","Juana","Luisa","Tomas")
- lista.place(x=10,y=20)
- boton = ttk.Button(text="Guardar", command=leer_lista)
- boton.place(x=150, y=120)
- # lista desplegable
- combobox = ttk.Combobox(state="readonly", values=[1,2,3,4,5,6,7,8,9,10])
- combobox.place(x=10,y=250)
- boton = ttk.Button(text="Guardar", command=leer_combo)
- boton.place(x=220, y=250)
- # casilla de verificacion
- estado = tk.BooleanVar()
- estado.set("True")
- casilla = ttk.Checkbutton(text="Acepto las condiciones", variable=estado)
- casilla.place(x=20, y=280)
- # barra de progreso
- barra = ttk.Progressbar(maximum=100)
- barra.place(x=10, y=450, width=200)
- barra.step(10)
- barra.start(10)
- barra = ttk.Progressbar(orient=tk.VERTICAL, maximum=100)
- barra.place(x=300, y=450, height=200)
- barra.step(10)
- barra.start(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement