def __init__(self, parent, controller, title, file_dir, result, isTyping, time, size): tk.Frame.__init__(self, parent) self.controller = controller heading = tk.Label(self, bg="white", fg="black", text=title, font='none 24 bold') heading.place(relx=0.5, rely=0.1, anchor=tk.CENTER) output_frame = hg.create_frame(self, 2) hg.create_label(output_frame, 'Result:', 0, 0) if (not isTyping): hg.create_label(output_frame, file_dir, 0, 1) else: hg.create_label(output_frame, result, 1, 0) info_frame = hg.create_frame(self, 3) hg.create_label(info_frame, 'Time elapsed: ' + str(time), 0, 0) hg.create_label(info_frame, 'Size: ' + str(size), 1, 0) back_frame = hg.create_frame(self, 4) hg.create_button(back_frame, 'Back', lambda: self.controller.show_frame("StartPage"), 0, 1)
def render_selected_key_frame(self): selected_key_frame = hg.create_frame(self, self.KEY_OPTION_ROW + 1) hg.create_label(selected_key_frame, 'Selected Key:', 0, 0) self.selected_key_entry = hg.create_entry(selected_key_frame, "", 1, 0) hg.create_button(selected_key_frame, 'Choose', lambda: self.load_selected_key(), 2, 0)
def render_mode_frame(self): mode_frame = hg.create_frame(self, self.MODE_ROW + 1) hg.create_label(mode_frame, 'Metode:', 0, 0) hg.create_radio_button(mode_frame, 'Encrypt', 0, self.encrypt, 1, 0, None) hg.create_radio_button(mode_frame, 'Decrypt', 1, self.encrypt, 1, 1, None)
def render_message_option_frame(self): message_option_frame = hg.create_frame(self, self.MESSAGE_OPTION_ROW + 1) hg.create_label(message_option_frame, 'Message Input:', 0, 0) hg.create_radio_button(message_option_frame, 'Type', 0, self.message_option, 1, 0, self.render_message_type_frame) hg.create_radio_button(message_option_frame, 'Select File', 1, self.message_option, 1, 1, self.render_message_file_frame)
def render_message_file_frame(self): self.destroy_frame(self.message_frame) self.destroy_frame(self.output_frame) self.render_message_frame() self.render_output_frame() hg.create_label(self.message_frame, self.message_dir, 0, 1, fix_text=False) hg.create_button(self.message_frame, 'Choose', lambda: self.load_message(), 1, 0)
def render_key_frame(self): public_key_frame = hg.create_frame(self, self.PUBLIC_KEY_ROW + 1) hg.create_label(public_key_frame, 'Public Key', 0, 0) hg.create_label(public_key_frame, self.public_key_dir, 0, 1, fix_text=False) hg.create_button(public_key_frame, 'Choose', lambda: self.load_public_key(), 1, 0) private_key_frame = hg.create_frame(self, self.PRIVATE_KEY_ROW + 1) hg.create_label(private_key_frame, 'Private Key', 0, 0) hg.create_label(private_key_frame, self.private_key_dir, 0, 1, fix_text=False) hg.create_button(private_key_frame, 'Choose', lambda: self.load_private_key(), 1, 0) button_key_frame = hg.create_frame(self, self.BUTTON_KEY_ROW + 1) hg.create_button(button_key_frame, 'Generate Key', lambda: self.generate_key(), 1, 0) hg.create_button(button_key_frame, 'Back', lambda: self.controller.show_frame("StartPage"), 1, 1)
def render_message_frame(self): self.message_frame = hg.create_frame(self, self.MESSAGE_ROW + 1) self.output_frame = hg.create_frame(self, self.OUTPUT_ROW + 1) hg.create_label(self.message_frame, 'Message', 0, 0)
def render_output_frame(self): hg.create_label(self.output_frame, 'Output', 0, 0) self.output_dir = hg.create_entry(self.output_frame, "", 1, 0) hg.create_label(self.output_frame, '.txt', 1, 1)
def render_y_frame(self): self.y_frame = hg.create_frame(self, self.Y_ROW + 1) hg.create_label(self.y_frame, 'Bilangan Bob Y', 0, 0) self.y_entry = hg.create_entry(self.y_frame, "", 1, 0)
def render_x_frame(self): self.x_frame = hg.create_frame(self, self.X_ROW + 1) hg.create_label(self.x_frame, 'Bilangan Alice X', 0, 0) self.x_entry = hg.create_entry(self.x_frame, "", 1, 0)
def render_g_frame(self): self.g_frame = hg.create_frame(self, self.G_ROW + 1) hg.create_label(self.g_frame, 'Bilangan G (G < N)', 0, 0) self.g_entry = hg.create_entry(self.g_frame, "", 1, 0)
def render_n_frame(self): self.n_frame = hg.create_frame(self, self.N_ROW + 1) hg.create_label(self.n_frame, 'Bilangan Prima N', 0, 0) self.n_entry = hg.create_entry(self.n_frame, "", 1, 0)