49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
import customtkinter as ctk
|
|
|
|
from frames import CTkTableFrame
|
|
from utils import fonts
|
|
|
|
app = ctk.CTk()
|
|
app.geometry("800x400")
|
|
|
|
|
|
def show_modal(row_data):
|
|
modal = ctk.CTkToplevel(app)
|
|
modal.geometry("250x150")
|
|
modal.title("Детали")
|
|
|
|
# Делаем модальное окно поверх основного
|
|
modal.grab_set()
|
|
modal.focus_force()
|
|
|
|
label_text = f"{row_data}"
|
|
label = ctk.CTkLabel(modal, text=label_text, font=("Arial", 12))
|
|
label.pack(pady=15)
|
|
|
|
close_btn = ctk.CTkButton(modal, text="Закрыть", command=modal.destroy)
|
|
close_btn.pack(pady=10)
|
|
|
|
|
|
ctk.set_appearance_mode("dark")
|
|
|
|
# _table_columns = [(0, "C", "ID"), (100, "Имя"), (100, "Логин"), (100, "Пароль"), (100, "Права"), (150, "Статус")]
|
|
_table_columns = [{"align": "center", "name": "ID"}, "Имя", "Логин", "Пароль", "Права", "Статус"]
|
|
_table_data = [
|
|
(1, "Master Admin", "admin", "*********", "Админ", "Активен"),
|
|
(2, "Первая стоматология Авиаконструкторов", "i00001608", "i00001608", "Доктор", "Заблокирован"),
|
|
(3, "Dental Lounge Ester", "i00151889", "*********", "Доктор", "Активен"),
|
|
*[(i, f"Имя {i}", f"i0015188{i}", f"i0015188{i}", "Доктор", "Активен") for i in range(4, 11)]
|
|
]
|
|
|
|
lable = ctk.CTkLabel(app, text="Тестовая таблица", font=fonts.title_font())
|
|
lable.pack(pady=10)
|
|
|
|
table = CTkTableFrame(app, _table_columns, _table_data, show_modal, width=700, height=200)
|
|
table.add((10000, "1", 1, "111111111111111111"))
|
|
table.pack(pady=10, padx=20, fill="both", expand=True)
|
|
|
|
but1 = ctk.CTkButton(app, text="Закрыть", command=app.destroy)
|
|
but1.pack(pady=10)
|
|
|
|
app.mainloop()
|