random_generator.py 603 B

12345678910111213141516171819202122232425262728
  1. #Random Generator
  2. from tkinter import *
  3. from random import randint
  4. def rand():
  5. tx['text'] = randint(int(m1.get()), int(m2.get()))
  6. root = Tk()
  7. root.title('Random Generator')
  8. root.geometry('500x300')
  9. root.resizable(False, False)
  10. m1 = StringVar()
  11. m2 = StringVar()
  12. d1 = Entry(root, font = '15', textvariable = m1)
  13. d2 = Entry(root, font = '15', textvariable = m2)
  14. button = Button(root, font = '15', text = 'Получить случайное число', command = rand)
  15. tx = Label(root, font = '20', text = '')
  16. d1.pack()
  17. d2.pack()
  18. button.pack()
  19. tx.pack()
  20. root.mainloop()