Advertisement
teslariu

place

Dec 18th, 2021
1,040
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.38 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # metodo place
  4.  
  5. def leer_lista():
  6.     nombre = lista.get(lista.curselection())
  7.     print(nombre)
  8.  
  9. def leer_combo():
  10.     numero = int(combobox.get())
  11.     print(numero)
  12.     print(type(numero))
  13.  
  14. import tkinter as tk
  15. from tkinter import ttk
  16.  
  17.  
  18.  
  19. ventana = tk.Tk()
  20. ventana.title("Formulario")
  21. ventana.config(width=400, height=800)
  22.  
  23. # imagen dentro de una etiqueta
  24. imagen_camion = tk.PhotoImage(file="camion.png")
  25. etiqueta = ttk.Label(image = imagen_camion)
  26. etiqueta.place(relx=0.5, rely=0.5, relwidth=0.5, relheight=0.5)
  27.  
  28. # lista fija
  29. lista = tk.Listbox()
  30. lista.insert(0,"Alejandro","Juana","Luisa","Tomas")
  31. lista.place(x=10,y=20)
  32. boton = ttk.Button(text="Guardar", command=leer_lista)
  33. boton.place(x=150, y=120)
  34.  
  35. # lista desplegable
  36. combobox = ttk.Combobox(state="readonly", values=[1,2,3,4,5,6,7,8,9,10])
  37. combobox.place(x=10,y=250)
  38. boton = ttk.Button(text="Guardar", command=leer_combo)
  39. boton.place(x=220, y=250)
  40.  
  41. # casilla de verificacion
  42. estado = tk.BooleanVar()
  43. estado.set("True")
  44. casilla = ttk.Checkbutton(text="Acepto las condiciones", variable=estado)
  45. casilla.place(x=20, y=280)
  46.  
  47. # barra de progreso
  48. barra = ttk.Progressbar(maximum=100)
  49. barra.place(x=10, y=450, width=200)
  50. barra.step(10)
  51. barra.start(10)
  52.  
  53. barra = ttk.Progressbar(orient=tk.VERTICAL, maximum=100)
  54. barra.place(x=300, y=450, height=200)
  55. barra.step(10)
  56. barra.start(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement