def fill_from_user(self): result = ask_add_password(password = new_random_password()) if result is None: return name, password, text = result return self.fill_from_arguments(name = name, password = password, text = text, deleted = False)
def new_password(event=None): password_length = number_of_chracters_entry.get() if not password_length.isdigit(): if not password_length and event: return else: password_length = "16" number_of_chracters_entry.delete(0, tk.END) number_of_chracters_entry.insert(0, password_length) password_length = int(password_length) characters = get_characters() if not characters: return new_password = new_random_password(password_length, characters) password_entry.delete(0, tk.END) root.after(100, password_entry.insert, 0, new_password)
def new_password(event=None): password_length = number_of_chracters_entry.get() if not password_length.isdigit(): if not password_length and event: return else: password_length = '16' number_of_chracters_entry.delete(0, tk.END) number_of_chracters_entry.insert(0, password_length) password_length = int(password_length) characters = get_characters() if not characters: return new_password = new_random_password(password_length, characters) password_entry.delete(0, tk.END) root.after(100, password_entry.insert, 0, new_password)
def ask_add_password(entry_frame, name='', password=None, text=''): name_label = tk.Label(master=entry_frame, text='name') name_label.grid(column=0, row=0) name_entry = tk.Entry(master=entry_frame) name_entry.grid(column=1, row=0, sticky=tk.W + tk.E, columnspan=2) name_entry.insert(0, name) password_label = tk.Label(master=entry_frame, text='password') password_label.grid(column=0, row=1) password_entry = tk.Entry(master=entry_frame, show=PASSWORD_CHARACTER) password_entry.grid(column=1, row=1, sticky=tk.W + tk.E) if password is None: password = new_random_password() password_entry.insert(0, password) bind_copy(password_entry) def new_password(event=None): password = ask_new_password() password_entry.delete(0, tk.END) password_entry.insert(0, password) new_password_button = tk.Button(master=entry_frame, text="new", command=new_password) new_password_button.grid(column=2, row=1) text_label = tk.Label(master=entry_frame, text='info') text_label.grid(column=0, row=2, sticky=tk.E + tk.S + tk.N) textbox = tk.Text(master=entry_frame, height=3, width=20) textbox.grid(column=1, row=2, sticky=tk.W + tk.E + tk.S + tk.N, columnspan=2) textbox.insert(tk.END, text) def return_press(event): textbox.insert(tk.INSERT, '\n') return "break" textbox.bind("<KeyPress-Return>", return_press) name_entry.focus_set() return 'New Password', lambda: (name_entry.get(), password_entry.get(), textbox.get('0.0', tk.END))
def ask_add_password(entry_frame, name = '', password = None, text = ''): name_label = tk.Label(master = entry_frame, text = 'name') name_label.grid(column = 0, row = 0) name_entry = tk.Entry(master = entry_frame) name_entry.grid(column = 1, row = 0, sticky = tk.W + tk.E, columnspan = 2) name_entry.insert(0, name) password_label = tk.Label(master = entry_frame, text = 'password') password_label.grid(column = 0, row = 1) password_entry = tk.Entry(master = entry_frame, show = PASSWORD_CHARACTER) password_entry.grid(column = 1, row = 1, sticky = tk.W + tk.E) if password is None: password = new_random_password() password_entry.insert(0, password) bind_copy(password_entry) def new_password(event = None): password = ask_new_password() password_entry.delete(0, tk.END) password_entry.insert(0, password) new_password_button = tk.Button(master = entry_frame, text = "new", command = new_password) new_password_button.grid(column = 2, row = 1) text_label = tk.Label(master = entry_frame, text = 'info') text_label.grid(column = 0, row = 2, sticky = tk.E + tk.S + tk.N) textbox = tk.Text(master = entry_frame, height = 3, width = 20) textbox.grid(column = 1, row = 2, sticky = tk.W + tk.E + tk.S + tk.N, columnspan = 2) textbox.insert(tk.END, text) def return_press(event): textbox.insert(tk.INSERT, '\n') return "break" textbox.bind("<KeyPress-Return>", return_press) name_entry.focus_set() return 'New Password', lambda: (name_entry.get(), password_entry.get(), textbox.get('0.0', tk.END))