Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # place.py
- import tkinter as tk
- from tkinter import ttk
- from tkinter import messagebox
- def saludar():
- print("Hola")
- def seleccion_lista():
- nombre = lista.get(lista.curselection())
- print(nombre)
- def seleccion_combo():
- curso = combo.get()
- print(curso)
- ventana = tk.Tk()
- ventana.title("Posicionamiento place")
- ventana.config(width=400, height=800)
- boton = ttk.Button(text="Saludo", command=saludar)
- boton.place(x=50,y=10)
- label = ttk.Label(text="Apreta el botón y te saludo...")
- label.place(x=160,y=10)
- # lista
- lista = tk.Listbox()
- lista.insert(0,"Alejandro","Juana","Ana")
- lista.place(x=10,y=100)
- boton = ttk.Button(text="Seleccionar", command=seleccion_lista)
- boton.place(x=10,y=270)
- # lista desplegable
- combo = ttk.Combobox(state="readonly",values=["C","Python","Java","GO"])
- combo.place(x=10,y=300)
- boton = ttk.Button(text="Seleccionar", command=seleccion_combo)
- boton.place(x=10,y=330)
- # 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 verificacion
- estado = tk.BooleanVar()
- estado.set("True")
- 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(50)
- barra.start(10)
- barra = ttk.Progressbar(maximum=100, orient=tk.VERTICAL)
- barra.place(x=300, y=500, height=200)
- barra.step(50)
- barra.start(10)
- ### cuadros de dialogo
- messagebox.showinfo(title="INFO", message="Hola gente")
- messagebox.showwarning(title="ADVERTENCIA", message="Ojito")
- messagebox.showerror(title="JAJAJA", message="Te equivocaste")
- ventana.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement