Advertisement
teslariu

dado tkinter

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