sábado, 24 de noviembre de 2018

U4: PRACTICA #14 GENERADOR DE NÚMEROS


EJECUCIÓN DE PROGRAMA
CÓDIGO DE PYTHON:


from Tkinter import *
from random import *

root = Tk()
root.geometry("500x350")
root.title("Generador de numeros")

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()

No hay comentarios:

Publicar un comentario

U4: PRACTICA #21 JUEGO EN 3D