Coding For Lukman Code For Random Number Generator

 Below is the script for the random number generator


import random
from tkinter import *
import tkinter as tk

def solution():
fromrange = fromentry.get()
torange= toentry.get()

finalanswer = random.randint(int(fromrange),int(torange))

answer.delete(0.0, END)
answer.insert(END, "The Answer is ")
answer.insert(END, finalanswer)




window = Tk()
window.resizable(0,0)
window.geometry("800x500")
window.title("Random Number generator")

title = Label(window,font=('Consolas',16,'bold'), text = "Welcome to random number generator",fg="black")
title.grid(row=1 ,column=3,padx=70,pady=30)

textrange = Label(window,font=('Consolas',17,'bold'),text = "Write the range of numbers",fg="black")
textrange.place(relx=.03 , rely=.25)

fromrange = Label(window,font=('Consolas',17,'bold'),text = "From:",fg="black")
fromrange.place(relx=.03 , rely=.35)

fromentry = tk.Entry()
fromentry.place(relx=.12,rely=.36)

torange = Label(window,font=('Consolas',17,'bold'),text = "To:",fg="black")
torange.place(relx=.34 , rely=.35)

toentry = tk.Entry()
toentry.place(relx=.40,rely=.36)

generate = Button(window,text = "Generate",font=('Consolas',15,'bold'),command=solution)
generate.place(relx=.24,rely=.44)

answer = Text(window, height=6, width=30,font=('Consolas'))
answer.place(relx=.13,rely=.75)


window.mainloop()

No comments:

Post a Comment

Drawing App For Kivy

  Below here is the source code for Drawing Application for kivy. Please if you like this content.  Don't forget to Subscribe to my YouT...