from Tkinter import *
from random import *
root = Tk()
root.geometry("500x500")
root.title("Generador de numeros")
root.config(bg="light steel blue")
def funcion():
num = randint(int(aux.get()), int(aux2.get()))
aux3.set(num)
et1 = Label(root, text="Numero 1").place(x=100, y=100)
et2 = Label(root, text="Numero 2").place(x=100, y=150)
et3 = Label(root, text="Numero generado").place(x=100, y=250)
arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
aux = StringVar()
aux2 = StringVar()
aux3 = StringVar()
s1 = Spinbox(root, textvariable=aux, values=arr1).place(x=300, y=100)
s2 = Spinbox(root, textvariable=aux2, values=arr2).place(x=300, y=150)
caja = Entry(root, textvariable=aux3).place(x=300, y=250)
b1 = Button(root, text="Generar", command=funcion).place(x=300, y=300)
root.mainloop()
lunes, 8 de abril de 2019
Numero aleatorio.
Programa que genera números a partir de 2 cantidades.