Advertisement
teslariu

place

Nov 29th, 2021
817
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.45 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4.  
  5. import tkinter as tk
  6. from tkinter import ttk
  7.  
  8. def guardar_lista():
  9.     nombre = lista.get(lista.curselection())
  10.     print(nombre)
  11.    
  12. def guardar_combo():
  13.     nombre = combo.get()
  14.     print(nombre)
  15.    
  16.  
  17. ventana = tk.Tk()
  18. ventana.title("Posicionamiento Place")
  19. ventana.config(width=600, height=800, bg="peru")
  20.  
  21. # lista desplegada (listbox)
  22. lista = tk.Listbox()
  23. lista.insert(0,"Ana","Tito","Juana","Carmen","Roberto")
  24. lista.place(x=10, y=50, width=100, height=100)
  25. boton = ttk.Button(text="Guardar", command=guardar_lista)
  26. boton.place(x=20, y=170)
  27.  
  28. # lista desplegable (combobox)
  29. combo = ttk.Combobox(state="readonly",values=["C++","Python","Java","PHP"])
  30. combo.place(x=20, y=250)
  31. boton = ttk.Button(text="Guardar", command=guardar_combo)
  32. boton.place(x=20, y=300)
  33.  
  34. # imagen (dentro de una etiqueta)
  35. imagen = tk.PhotoImage(file="camion.png")
  36. label = ttk.Label(image=imagen)
  37. label.place(relx=0.5, rely=0.5, relwidth=0.5, relheight=0.5)
  38.  
  39. # casilla de verificación
  40. estado = tk.BooleanVar()
  41. estado.set("True")
  42. casilla = ttk.Checkbutton(text="Acepto los términos y condiciones",variable=estado)
  43. casilla.place(x=20, y=360)
  44.  
  45. # barras de progreso
  46. barra = ttk.Progressbar(maximum=100)
  47. barra.place(x=10, y=450, width=200)
  48. barra.step(99.9)
  49. barra.start(30)
  50.  
  51. barra = ttk.Progressbar(maximum=100, orient=tk.VERTICAL)
  52. barra.place(x=270, y=450, height=200)
  53. barra.step(99.9)
  54. barra.start(30)
  55.  
  56.  
  57. ventana.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement