add first income
Browse files- Dockerfile +11 -0
- main.py +119 -0
- requirements.txt +0 -0
Dockerfile
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
|
3 |
+
WORKDIR /code
|
4 |
+
|
5 |
+
COPY ./requirements.txt /code/requirements.txt
|
6 |
+
|
7 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
8 |
+
|
9 |
+
COPY . .
|
10 |
+
|
11 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
main.py
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import customtkinter
|
2 |
+
import os
|
3 |
+
from PIL import Image
|
4 |
+
|
5 |
+
|
6 |
+
class App(customtkinter.CTk):
|
7 |
+
def __init__(self):
|
8 |
+
super().__init__()
|
9 |
+
|
10 |
+
self.title("ОтрубИ")
|
11 |
+
self.geometry("700x450")
|
12 |
+
|
13 |
+
# set grid layout 1x2
|
14 |
+
self.grid_rowconfigure(0, weight=1)
|
15 |
+
self.grid_columnconfigure(1, weight=1)
|
16 |
+
|
17 |
+
# create navigation frame
|
18 |
+
self.navigation_frame = customtkinter.CTkFrame(self, corner_radius=0)
|
19 |
+
self.navigation_frame.grid(row=0, column=0, sticky="nsew")
|
20 |
+
self.navigation_frame.grid_rowconfigure(4, weight=1)
|
21 |
+
|
22 |
+
self.navigation_frame_label = customtkinter.CTkLabel(
|
23 |
+
self.navigation_frame,
|
24 |
+
text="Главное меню",
|
25 |
+
compound="left",
|
26 |
+
font=customtkinter.CTkFont(size=15, weight="bold")
|
27 |
+
)
|
28 |
+
self.navigation_frame_label.grid(row=0, column=0, padx=20, pady=20)
|
29 |
+
|
30 |
+
self.home_button = customtkinter.CTkButton(
|
31 |
+
self.navigation_frame,
|
32 |
+
corner_radius=0,
|
33 |
+
height=40,
|
34 |
+
border_spacing=10,
|
35 |
+
text="Обработка строк",
|
36 |
+
fg_color="transparent",
|
37 |
+
text_color=("gray10", "gray90"),
|
38 |
+
hover_color=("gray70", "gray30"),
|
39 |
+
anchor="w",
|
40 |
+
command=self.home_button_event)
|
41 |
+
self.home_button.grid(row=1, column=0, sticky="ew")
|
42 |
+
|
43 |
+
self.frame_2_button = customtkinter.CTkButton(
|
44 |
+
self.navigation_frame,
|
45 |
+
corner_radius=0,
|
46 |
+
height=40,
|
47 |
+
border_spacing=10,
|
48 |
+
text="Обработка документа",
|
49 |
+
fg_color="transparent",
|
50 |
+
text_color=("gray10", "gray90"),
|
51 |
+
hover_color=("gray70", "gray30"),
|
52 |
+
anchor="w",
|
53 |
+
command=self.frame_2_button_event)
|
54 |
+
self.frame_2_button.grid(row=2, column=0, sticky="ew")
|
55 |
+
|
56 |
+
self.appearance_mode_menu = customtkinter.CTkOptionMenu(self.navigation_frame, values=["Light", "Dark", "System"],
|
57 |
+
command=self.change_appearance_mode_event)
|
58 |
+
self.appearance_mode_menu.grid(row=6, column=0, padx=20, pady=20, sticky="s")
|
59 |
+
|
60 |
+
# create home frame
|
61 |
+
self.home_frame = customtkinter.CTkFrame(self, corner_radius=0, fg_color="transparent")
|
62 |
+
self.home_frame.grid_columnconfigure(0, weight=1)
|
63 |
+
|
64 |
+
self.home_frame_label = customtkinter.CTkLabel(self.home_frame, text="Преобразование текста")
|
65 |
+
self.home_frame_label.grid(row=0, column=0, padx=20, pady=10)
|
66 |
+
|
67 |
+
self.home_text_in = customtkinter.CTkTextbox(self.home_frame, width=400, height=150, corner_radius=0)
|
68 |
+
self.home_text_in.grid(row=1, column=0, padx=10, pady=10)
|
69 |
+
self.home_text_in.insert("0.0", "Текст для преобразования")
|
70 |
+
|
71 |
+
self.home_frame_button_process = customtkinter.CTkButton(self.home_frame, text="Process", compound="right", command=self.button_process_event)
|
72 |
+
self.home_frame_button_process.grid(row=2, column=0, padx=10, pady=10)
|
73 |
+
|
74 |
+
self.home_text_out = customtkinter.CTkTextbox(self.home_frame, width=400, height=150, corner_radius=0)
|
75 |
+
self.home_text_out.grid(row=3, column=0, padx=10, pady=10)
|
76 |
+
self.home_text_out.insert("0.0", "Текст после преобразования")
|
77 |
+
|
78 |
+
# create second frame
|
79 |
+
self.second_frame = customtkinter.CTkFrame(self, corner_radius=0, fg_color="transparent")
|
80 |
+
|
81 |
+
# create third frame
|
82 |
+
self.third_frame = customtkinter.CTkFrame(self, corner_radius=0, fg_color="transparent")
|
83 |
+
|
84 |
+
# select default frame
|
85 |
+
self.select_frame_by_name("home")
|
86 |
+
|
87 |
+
def select_frame_by_name(self, name):
|
88 |
+
# set button color for selected button
|
89 |
+
self.home_button.configure(fg_color=("gray75", "gray25") if name == "home" else "transparent")
|
90 |
+
self.frame_2_button.configure(fg_color=("gray75", "gray25") if name == "frame_2" else "transparent")
|
91 |
+
|
92 |
+
# show selected frame
|
93 |
+
if name == "home":
|
94 |
+
self.home_frame.grid(row=0, column=1, sticky="nsew")
|
95 |
+
else:
|
96 |
+
self.home_frame.grid_forget()
|
97 |
+
if name == "frame_2":
|
98 |
+
self.second_frame.grid(row=0, column=1, sticky="nsew")
|
99 |
+
else:
|
100 |
+
self.second_frame.grid_forget()
|
101 |
+
|
102 |
+
def button_process_event(self):
|
103 |
+
self.home_text_out.delete("0.0", "end-1c")
|
104 |
+
self.home_text_out.insert("0.0", f"{self.home_text_in.get("0.0", "end-1c")} - после преобразования")
|
105 |
+
|
106 |
+
def home_button_event(self):
|
107 |
+
self.select_frame_by_name("home")
|
108 |
+
|
109 |
+
def frame_2_button_event(self):
|
110 |
+
self.select_frame_by_name("frame_2")
|
111 |
+
|
112 |
+
|
113 |
+
def change_appearance_mode_event(self, new_appearance_mode):
|
114 |
+
customtkinter.set_appearance_mode(new_appearance_mode)
|
115 |
+
|
116 |
+
|
117 |
+
if __name__ == "__main__":
|
118 |
+
app = App()
|
119 |
+
app.mainloop()
|
requirements.txt
ADDED
Binary file (150 Bytes). View file
|
|