Advertisement
teslariu

dado1

Nov 11th, 2021
1,101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. import random
  5. import tkinter as tk
  6.  
  7.  
  8. def tirar_dado():
  9.     caja.delete(0,tk.END)
  10.     valor = random.randint(1,6)
  11.     caja.insert(0,valor)
  12.  
  13.  
  14. ventana = tk.Tk()
  15. ventana.title("Dado 2.0")
  16. ventana.config(width=300, height=300)
  17. ventana.resizable(0,0)
  18.  
  19. boton = tk.Button(text="Arrojar el dado", command=tirar_dado)
  20. boton.place(x=80, y=30, width=150, height=50)
  21.  
  22. etiqueta = tk.Label(text="Valor:")
  23. etiqueta.place(x=80, y=100)
  24.  
  25. caja = tk.Entry()
  26. caja.place(x=80, y=130, width=150, height=35)
  27.  
  28.  
  29. ventana.mainloop()
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement