DiscreteMathematics/Lab_1/window_2.py

105 lines
4.0 KiB
Python
Raw Permalink Normal View History

2024-03-09 17:44:57 +02:00
from tkinter import *
root = Tk()
root.title("Розрахунки початкового виразу")
# Віджети введених множин
sets_frame = Frame(root, bd=5)
set_A_label = Label(sets_frame, text="Множина A:", bd=5)
elements_A_label = Label(sets_frame)
set_B_label = Label(sets_frame, text="Множина B:", bd=5)
elements_B_label = Label(sets_frame)
set_C_label = Label(sets_frame, text="Множина C:", bd=5)
elements_C_label = Label(sets_frame)
set_labels = [elements_A_label, elements_B_label, elements_C_label]
# Пакувальники введених множин
sets_frame.grid(row=0, column=0)
set_A_label.grid(row=0, column=0, sticky=E)
elements_A_label.grid(row=0, column=1, sticky=W)
set_B_label.grid(row=1, column=0, sticky=E)
elements_B_label.grid(row=1, column=1, sticky=W)
set_C_label.grid(row=2, column=0, sticky=E)
elements_C_label.grid(row=2, column=1, sticky=W)
# Кнопка початку розрахунків
start_calculations_button = Button(root, text="Почати розрахунки")
start_calculations_button.grid(row=1, column=0)
# Віджети покрокового розв'язання
calculations_frame = Frame(root, bd=5)
expression_label = Label(calculations_frame, text="Вираз: D = ¬A B ¬C (B ∩ ¬C) (¬A ∩ C) (A ∩ B)", bd=5)
first_step_label = Label(calculations_frame, text="(B ∩ ¬C) = ", bd=5)
first_step_result = Label(calculations_frame)
second_step_label = Label(calculations_frame, text="(¬A ∩ C) = ", bd=5)
second_step_result = Label(calculations_frame)
third_step_label = Label(calculations_frame, text="(A ∩ B) = ", bd=5)
third_step_result = Label(calculations_frame)
fourth_step_label = Label(calculations_frame, text="(¬A ∩ C) (A ∩ B) = ", bd=5)
fourth_step_result = Label(calculations_frame)
fifth_step_label = Label(calculations_frame, text="(B ∩ ¬C) (¬A ∩ C) (A ∩ B) = ", bd=5)
fifth_step_result = Label(calculations_frame)
sixth_step_label = Label(calculations_frame, text="¬C (B ∩ ¬C) (¬A ∩ C) (A ∩ B) = ", bd=5)
sixth_step_result = Label(calculations_frame)
seventh_step_label = Label(calculations_frame, text="B ¬C (B ∩ ¬C) (¬A ∩ C) (A ∩ B) = ", bd=5)
seventh_step_result = Label(calculations_frame)
eighth_step_label = Label(calculations_frame, text="¬A B ¬C (B ∩ ¬C) (¬A ∩ C) (A ∩ B) = ", bd=5)
eighth_step_result = Label(calculations_frame)
calculation_result_labels = [first_step_result, second_step_result, third_step_result, fourth_step_result, fifth_step_result, sixth_step_result, seventh_step_result, eighth_step_result]
# Пакувальники покрокового розв'язання
calculations_frame.grid(row=2, column=0)
expression_label.grid(row=0, column=0, columnspan=2)
first_step_label.grid(row=1, column=0, sticky=E)
second_step_label.grid(row=2, column=0, sticky=E)
third_step_label.grid(row=3, column=0, sticky=E)
fourth_step_label.grid(row=4, column=0, sticky=E)
fifth_step_label.grid(row=5, column=0, sticky=E)
sixth_step_label.grid(row=6, column=0, sticky=E)
seventh_step_label.grid(row=7, column=0, sticky=E)
eighth_step_label.grid(row=8, column=0, sticky=E)
first_step_result.grid(row=1, column=1, sticky=W)
second_step_result.grid(row=2, column=1, sticky=W)
third_step_result.grid(row=3, column=1, sticky=W)
fourth_step_result.grid(row=4, column=1, sticky=W)
fifth_step_result.grid(row=5, column=1, sticky=W)
sixth_step_result.grid(row=6, column=1, sticky=W)
seventh_step_result.grid(row=7, column=1, sticky=W)
eighth_step_result.grid(row=8, column=1, sticky=W)
# Віджети множини D
d_frame = Frame(root, bd=5)
set_D_label = Label(d_frame, text="Множина D:", bd=5)
elements_D_label = Label(d_frame)
save_D_button = Button(d_frame, text="Зберегти D")
# Пакувальники множини D
d_frame.grid(row=3, column=0)
set_D_label.grid(row=0, column=0, sticky=E)
elements_D_label.grid(row=0, column=1, sticky=W)
save_D_button.grid(row=1, column=0, columnspan=2)