Advertisement
teslariu

widg

Jun 19th, 2021
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.83 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # PLACE
  5.  
  6. import tkinter as tk
  7. from tkinter import ttk
  8.  
  9. def saludar():
  10.     nombre = caja.get()
  11.     print(nombre)
  12.     caja.delete(0, tk.END)
  13.     caja.insert(0, "Hola")
  14.    
  15. def guardar_lista():
  16.     eleccion = lista.get(lista.curselection())
  17.     print(eleccion)
  18.    
  19. def guardar_combo():
  20.     print(combobox.get())
  21.    
  22.    
  23.    
  24.  
  25. ventana = tk.Tk()
  26. ventana.title("Posicionamiento PLACE")
  27. ventana.config(width=400, height=800)
  28.  
  29. boton = ttk.Button(text="Saludar", command=saludar)
  30. boton.place(x=50, y=10, width=100, height=50)
  31.  
  32. caja = ttk.Entry()
  33. caja.place(x=50, y=70)
  34.  
  35. etiqueta = ttk.Label(text="Ingrese su nombre: ")
  36. etiqueta.place(x=190, y=70 )
  37.  
  38. ## imagen dentro de una etiqueta
  39. imagen = tk.PhotoImage(file="camion.png")
  40. etiqueta = ttk.Label(image=imagen)
  41. etiqueta.place(relx=0.5, rely=0.5, relwidth=0.5, relheight=0.5)
  42.  
  43. # lista
  44. lista = tk.Listbox()
  45. lista.insert(0,"Python", "C", "C++", "Java")
  46. lista.place(x=10, y=100)
  47. boton = ttk.Button(text="Guardar selección", command=guardar_lista)
  48. boton.place(x=10, y=270)
  49.  
  50. # lista desplegable
  51. combobox = ttk.Combobox(state="readonly",
  52.                         values=[
  53.                                 "Visual Basic",
  54.                                 "Erlang",
  55.                                 "Julia"
  56.                                 ]
  57.                         )
  58. combobox.place(x=10, y=300)
  59. boton = ttk.Button(text="Guardar", command=guardar_combo)
  60. boton.place(x=10, y=330)
  61.  
  62. # casilla
  63. estado = tk.BooleanVar()
  64. estado.set("False")
  65. casilla = ttk.Checkbutton(text="Acepto las condiciones", variable=estado)
  66. casilla.place(x=10, y=380)
  67.  
  68. # barra de progreso
  69. barra = ttk.Progressbar(maximum=60, orient=tk.VERTICAL)
  70. barra.place(x=10, y=450, height=200)
  71. barra.step(25)
  72. barra.start(100)
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84. ventana.mainloop()
  85.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement