-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRandomIntegerPrinter_V1.0.0.py
More file actions
27 lines (21 loc) · 1007 Bytes
/
RandomIntegerPrinter_V1.0.0.py
File metadata and controls
27 lines (21 loc) · 1007 Bytes
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
from tkinter import *
from tkinter import font
import random
def judge():
num1=input1.get()
num2=input2.get()
if num1.isdigit() and num2.isdigit() and num1<=num2:
var.set(random.randint(int(num1),int(num2)))
root=Tk()
root.title('随机整数打印器 Ver. 1.0.0')
root.geometry('540x540')
Label(root,text='起始数:',font=('NSimSun',15)).place(relx=0.1,rely=-0.32,relheight=0.9,relwidth=0.15)
input1=Entry(root,font=('NSimSun',15))
input1.place(relx=0.225,rely=0.1, relheight=0.05,relwidth=0.1)
Label(root,text='结束数:',font=('NSimSun',15)).place(relx=0.6,rely=-0.32,relheight=0.9,relwidth=0.15)
input2=Entry(root,font=('NSimSun',15))
input2.place(relx=0.725,rely=0.1, relheight=0.05,relwidth=0.1)
var=StringVar()
Entry(root,textvariable=var,font=('NSimSun',30)).place(relx=0.4,rely=0.4,relheight=0.2,relwidth=0.2)
Button(root,text='打印',font=('NSimSun',15),command=judge).place(relx=0.4,rely=0.6,relheight=0.1,relwidth=0.2)
root.mainloop()