python_by_example/tkgui/sols_124-132/sol_02.py

19 lines
361 B
Python
Raw Normal View History

2023-11-17 13:26:09 -03:00
from tkinter import *
import random
def click():
num = random.randint(1,6)
answer["text"] = num
window = Tk()
window.title("Tira un Dado")
window.geometry("100x200")
button1 = Button(text="Roll", command=click)
button1.place(x=30, y=30, width=50, height=25)
answer = Message(text="")
answer.place(x=40, y=70, width=30, height=25)
window.mainloop()