Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # Posicionamiento place
- import tkinter as tk
- from tkinter import ttk
- def seleccionar():
- nombre = lista.get(lista.curselection())
- print(nombre)
- def seleccionar2():
- lenguaje = combo.get()
- print(lenguaje)
- ventana = tk.Tk()
- ventana.title("Posicionamiento place")
- ventana.config(width=400, height=800)
- # imagen dentro de una etiqueta
- imagen = tk.PhotoImage(file='bandera.png')
- etiqueta = ttk.Label(image=imagen)
- etiqueta.place(relx=0.5, rely=0.5, relwidth=0.5, relheight=0.5)
- # listas tipo listbox
- lista = tk.Listbox()
- lista.insert(0,"Ana","Tito","Juan","Andrea")
- lista.place(x=10, y=40)
- boton = ttk.Button(text="Seleccionar", command=seleccionar)
- boton.place(x=10, y=220)
- # lista desplegable (combobox)
- combo = ttk.Combobox(state="readonly", values=["C","Java","Python","Julia"])
- combo.place(x=10, y=280)
- boton = ttk.Button(text="Seleccion", command=seleccionar2)
- boton.place(x=10, y=320)
- # 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(10)
- barra.start(5)
- barraV = ttk.Progressbar(maximum=100, orient=tk.VERTICAL)
- barraV.place(x=300, y=450, height=200)
- barraV.step(10)
- barraV.start(5)
- ventana.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement