/
chibranof
/
randomizer
Обзор
Документация
Войти
/
chibranof
/
randomizer
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
main.py
59 строк
2 KB
chibranof
upload files
27 мар 2025, 16:28
27 мар 2025, 16:28
0f0339a
Код
Авторство
О чём код?
import tkinter as tk import random from tkinter import simpledialog root = tk.Tk() root.title("Рандомайзер") root.geometry("700x800") root.config(bg="#bb99e8") root.resizable(False, False) label = tk.Label(root, text="Введите параметры", width=14) label.config(bg='white', padx=230, pady=70, font=("Lucida Console", 15, "bold")) label.place(x=25, y=20) def input_become(): global input_first number_f = simpledialog.askinteger("Ввод числа", "Введите число:") if number_f is not None: input_first = number_f label.config(text=f"От {input_first}") btn_finish.config(state=tk.NORMAL) def input_finish(): global input_second number_s = simpledialog.askinteger("Ввод числа", "Введите число:") if number_s is not None: input_second = number_s label.config(text=f"До {input_second}") btn_result.config(state=tk.NORMAL) def resultt(): global result, input_first, input_second if input_first <= input_second: result = random.randint(input_first, input_second) label.config(text=f"Случайное число: {result}") else: result = random.randint(input_second, input_first) label.config(text=f"Случайное число: {result}") input_first = None input_second = None result = None btn_become = tk.Button(root, text="ОТ", command=input_become) btn_become.config(bg="#ed77ae", fg="black", font=("Lucida Console", 18, "bold"), padx=120, pady=170, bd=10) btn_become.place(x=25, y=200) btn_finish = tk.Button(root, text="ДО", command=input_finish) btn_finish.config(bg="#ed77ae", fg="black", font=("Lucida Console", 18, "bold"), padx=120, pady=170, bd=10, state=tk.DISABLED) btn_finish.place(x=372, y=200) btn_result = tk.Button(root, text="РЕЗУЛЬТАТ", command=resultt) btn_result.config(bg="#ed77ae", fg="black", font=("Lucida Console", 18, "bold"), padx=240, pady=50, bd=10, state=tk.DISABLED) btn_result.place(x=25, y=610) root.mainloop()