Advertisement
teslariu

place

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