Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # PLACE
- import tkinter as tk
- from tkinter import ttk
- def saludar():
- nombre = caja.get()
- print(nombre)
- caja.delete(0, tk.END)
- caja.insert(0, "Hola")
- def guardar_lista():
- eleccion = lista.get(lista.curselection())
- print(eleccion)
- def guardar_combo():
- print(combobox.get())
- ventana = tk.Tk()
- ventana.title("Posicionamiento PLACE")
- ventana.config(width=400, height=800)
- boton = ttk.Button(text="Saludar", command=saludar)
- boton.place(x=50, y=10, width=100, height=50)
- caja = ttk.Entry()
- caja.place(x=50, y=70)
- etiqueta = ttk.Label(text="Ingrese su nombre: ")
- etiqueta.place(x=190, y=70 )
- ## imagen dentro de una etiqueta
- imagen = tk.PhotoImage(file="camion.png")
- etiqueta = ttk.Label(image=imagen)
- etiqueta.place(relx=0.5, rely=0.5, relwidth=0.5, relheight=0.5)
- # lista
- lista = tk.Listbox()
- lista.insert(0,"Python", "C", "C++", "Java")
- lista.place(x=10, y=100)
- boton = ttk.Button(text="Guardar selección", command=guardar_lista)
- boton.place(x=10, y=270)
- # lista desplegable
- combobox = ttk.Combobox(state="readonly",
- values=[
- "Visual Basic",
- "Erlang",
- "Julia"
- ]
- )
- combobox.place(x=10, y=300)
- boton = ttk.Button(text="Guardar", command=guardar_combo)
- boton.place(x=10, y=330)
- # casilla
- estado = tk.BooleanVar()
- estado.set("False")
- casilla = ttk.Checkbutton(text="Acepto las condiciones", variable=estado)
- casilla.place(x=10, y=380)
- # barra de progreso
- barra = ttk.Progressbar(maximum=60, orient=tk.VERTICAL)
- barra.place(x=10, y=450, height=200)
- barra.step(25)
- barra.start(100)
- ventana.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement