George_Zagorsky_1

Делители числа

Jan 15th, 2023
675
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.69 KB | None | 0 0
  1. from tkinter import *
  2. from tkinter import ttk
  3.  
  4. Ox = 600
  5. Oy = 500
  6. resizable_first = False
  7. resizable_second = False
  8. global_DIGIT = None
  9. global_Button = None
  10.  
  11.  
  12. def show_click():
  13.     global global_DIGIT
  14.     global_DIGIT = entry_button.get()
  15.     stack = [x for x in global_DIGIT if x.isdigit()]
  16.     if len(stack) == len(global_DIGIT):
  17.         print("Число введено верно")
  18.     else:
  19.         pass
  20.  
  21.  
  22. def selected_radioButtom():
  23.     global global_Button
  24.     global_Button = entry_button.get()
  25.     print(global_Button)
  26.  
  27.  
  28. window = Tk()
  29. label = Label(window, text="This is Label widget", fg='red', font=("Helvetica", 23))
  30. label.place(x=190, y=50)
  31. entry_button = Entry(window, text="This is Entry Widget", bd=5)
  32. entry_button.place(x=190, y=110)
  33. button = Button(window, text="Расчитать", fg='blue', command=show_click)
  34. button.place(x=215, y=250)
  35. v0 = StringVar()
  36. r1 = Radiobutton(window, text="Все делители числа", variable=v0, value="Все делители числа",
  37.                  command=selected_radioButtom)
  38. r2 = Radiobutton(window, text="Разложить на простые множители", variable=v0, value="Разложить на простые множители",
  39.                  command=selected_radioButtom)
  40. r3 = Radiobutton(window, text="Использовать оба варианта", variable=v0, value="Использовать оба варианта",
  41.                  command=selected_radioButtom)
  42. r1.place(x=215, y=180)
  43. r2.place(x=215, y=200)
  44. r3.place(x=215, y=220)
  45. window.title("Делители числа")
  46. window.geometry(f"{Ox}x{Oy}")
  47. window.resizable(resizable_first, resizable_second)
  48.  
  49. window.mainloop()
  50.  
Advertisement
Add Comment
Please, Sign In to add comment