base.destroy()\r
\r
def radiobutton_event():\r
+ global toggle\r
+\r
print("radiobutton toggled, current value:", radio_var.get())\r
print("ChatLog.winfo_children()", ChatLog.winfo_children())\r
- for child in ChatLog.winfo_children():\r
- if child.widgetName == "frame":\r
- child.destroy()\r
- ChatLog.delete('0.0', END)\r
- if radio_var.get() == 2:\r
- Bot.destroy()\r
- welcomeText = "Assistant: Hey, Welcome to TC Assistance System. Tell me how would you like to proceed? \n > You can add a new UTC in existing module\n > You can add UTC in new module\n > Support Assistant\n > Remove Deprecated APIs\n"\r
- welcomeText = translate_to_ko(welcomeText)\r
- Bot_ko = customtkinter.CTkLabel(ChatLog,text=welcomeText+"\n\n", justify='left', fg_color='#C0C0C0',text_color='black',corner_radius=10,font=("Malgun Gothic", 13),wraplength=500, cursor="hand2")\r
- ChatLog.window_create('end', window=Bot_ko)\r
- ChatLog.insert(END, '\n')\r
- elif radio_var.get() == 1:\r
- Bot.destroy()\r
- welcomeText = "Assistant: Hey, Welcome to TC Assistance System. Tell me how would you like to proceed? \n > You can add a new UTC in existing module\n > You can add UTC in new module\n > Support Assistant\n > Remove Deprecated APIs\n"\r
- Bot_ko = customtkinter.CTkLabel(ChatLog,text=welcomeText+"\n", justify='left', fg_color='#C0C0C0',text_color='black',corner_radius=10,font=("Malgun Gothic", 13),wraplength=500, cursor="hand2")\r
- ChatLog.window_create('end', window=Bot_ko)\r
- ChatLog.insert(END, '\n')\r
- return radio_var.get()\r
+\r
+ # get yes/no answers whether user want to change language or not\r
+ msg = CTkMessagebox(title="Exit?", message="Your current progress will be lost. Do you want to switch language?",\r
+ icon="question", option_1="No", option_2="Yes", option_3="",option_focus=2)\r
+ response = msg.get()\r
+\r
+ if response=="Yes":\r
+ ChatLog.mark_set("end", "1.0")\r
+ if toggle != radio_var.get():\r
+ for child in ChatLog.winfo_children():\r
+ if child.widgetName == "frame":\r
+ child.destroy()\r
+ ChatLog.delete(0, END)\r
+ if radio_var.get() == 2:\r
+ Bot.destroy()\r
+ welcomeText = "Assistant: Hey, Welcome to TC Assistance System. Tell me how would you like to proceed? \n > You can add a new UTC in existing module\n > You can add UTC in new module\n > Support Assistant\n > Remove Deprecated APIs\n"\r
+ welcomeText = translate_to_ko(welcomeText)\r
+ Bot_ko = customtkinter.CTkLabel(ChatLog,text=welcomeText+"\n\n", justify='left', fg_color='#C0C0C0',text_color='black',corner_radius=10, padx=10, pady=5, font=("Malgun Gothic", 13),wraplength=500, cursor="hand2")\r
+ WhiteSpace = customtkinter.CTkLabel(ChatLog,text="This is a empty line label", justify='left',text_color='#d3d3d3',corner_radius=10, padx=10, pady=5, font=("Malgun Gothic", 13),wraplength=500, cursor="hand2")\r
+ ChatLog.insert('0.0', '\n')\r
+ ChatLog.window_create('0.0', window=WhiteSpace)\r
+ ChatLog.insert(END, '\n')\r
+ ChatLog.window_create('end', window=Bot_ko)\r
+ ChatLog.insert(END, '\n')\r
+ ChatLog.see("1.0")\r
+ ChatLog.tag_add("no_padding", "end-1c linestart", "end-1c lineend")\r
+ ChatLog.tag_configure("no_padding", lmargin1=0, lmargin2=0, rmargin=0)\r
+ ChatLog.insert(END, "")\r
+\r
+ elif radio_var.get() == 1:\r
+ Bot.destroy()\r
+ welcomeText = "Assistant: Hey, Welcome to TC Assistance System. Tell me how would you like to proceed? \n > You can add a new UTC in existing module\n > You can add UTC in new module\n > Support Assistant\n > Remove Deprecated APIs\n"\r
+ Bot_ko = customtkinter.CTkLabel(ChatLog,text=welcomeText+"\n", justify='left', fg_color='#C0C0C0',text_color='black',corner_radius=10, padx=10, pady=5, font=("Malgun Gothic", 13),wraplength=500, cursor="hand2")\r
+ WhiteSpace = customtkinter.CTkLabel(ChatLog,text="This is a empty line label", justify='left',text_color='#d3d3d3',corner_radius=10, padx=10, pady=5, font=("Malgun Gothic", 13),wraplength=500, cursor="hand2")\r
+ ChatLog.insert('0.0', '\n')\r
+ ChatLog.window_create('0.0', window=WhiteSpace)\r
+ ChatLog.insert(END, '\n')\r
+ ChatLog.window_create('end', window=Bot_ko)\r
+ ChatLog.insert(END, '\n')\r
+ ChatLog.see("1.0")\r
+ ChatLog.tag_add("no_padding", "end-1c linestart", "end-1c lineend")\r
+ ChatLog.tag_configure("no_padding", lmargin1=0, lmargin2=0, rmargin=0)\r
+ ChatLog.insert(END, "")\r
+ toggle = radio_var.get()\r
+ return radio_var.get()\r
+ else:\r
+ if toggle != radio_var.get():\r
+ if radio_var.get() == 2:\r
+ radiobutton_1.select()\r
+ elif radio_var.get() == 1:\r
+ radiobutton_2.select()\r
+ toggle = radio_var.get()\r
\r
\r
CURRENT_PATH = get_current_dir_path()\r
log_info_save(logger, "Assitant", welcomeText)\r
\r
radio_var = tkinter.IntVar(value=0)\r
+toggle = 1\r
Bot = customtkinter.CTkLabel(ChatLog,text="Assistant: "+welcomeText, justify='left', fg_color='#C0C0C0',text_color='black',corner_radius=10,font=("Malgun Gothic", 13),wraplength=500, cursor="hand2")\r
ChatLog.insert('end', '\n ')\r
ChatLog.window_create('end', window=Bot)\r