-
Notifications
You must be signed in to change notification settings - Fork 161
/
numbergen.py
34 lines (26 loc) · 898 Bytes
/
numbergen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from tkinter import *
import random
def gen():
num1 = int(entry1.get())
num2 = int(entry2.get())
out = random.randrange(num1, num2)
output.config(text=out)
root = Tk()
global entry1, entry2, output
label1 = Label(root, text="Enter Minimum Range")
label2 = Label(root, text="Enter Maximum Range")
label1.grid(row=0, column=0, padx=10, pady=10)
label2.grid(row=1, column=0, padx=10, pady=10)
entry1 = Entry(root)
entry2 = Entry(root)
entry1.grid(row=0, column=1, padx=10, pady=10)
entry2.grid(row=1, column=1, padx=10, pady=10)
entry1.insert(END, '1')
entry2.insert(END, '100')
button1 = Button(root, text="Submit", command=gen)
button2 = Button(root, text="Close", command=lambda : quit())
button1.grid(row=2, column=0, padx=10, pady=10)
button2.grid(row=2, column=1, padx=10, pady=10)
output = Label(root, text="")
output.grid(row=3, column=0, columnspan=2)
root.mainloop()