Skip to content

Commit

Permalink
changed behavior of tab to move to next text field, like expected.
Browse files Browse the repository at this point in the history
  • Loading branch information
Odyhibit committed Jun 19, 2024
1 parent c48c507 commit 258c5bc
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def __init__(self, root):
tabcontrol.add("Encode")
tabcontrol.add("Decode")

def convert_hidden(self):

def convert_hidden(e):
"""This converts the secret text to show the limits of the bacon cipher.
Only uppercase. J -> I and V -> U.
"""
Expand All @@ -45,14 +46,23 @@ def convert_hidden(self):
new_text = new_text.replace("J", "I")
new_text = new_text.replace("V", "U")
hidden_text.insert("1.0", new_text)
check_length()
check_length(e)


def tab_to_hidden_text(e):
if e.keycode == 9:
cover_text.focus_set()

def check_length(self):

def check_length(e):
"""Check to see if there are enough cover text characters to hide the plaintext.
If there is then we enable the calc_button, if not we disable it.
:return: nothing is returned
"""

if e.keycode == 9:
calc_button.focus_set()
cover_str = cover_text.get("1.0", "end-1c")
hidden_str = hidden_text.get("1.0", "end-1c").replace(" ", "")
cover = 0
Expand Down Expand Up @@ -137,6 +147,7 @@ def copy_to_clipboard():
value="GitHub").grid(column=0, row=9, columnspan=2, padx=5)

hidden_text.bind("<FocusOut>", convert_hidden)
hidden_text.bind("<KeyRelease>", tab_to_hidden_text)
cover_text.bind("<KeyRelease>", check_length)

# DECODING
Expand Down

0 comments on commit 258c5bc

Please sign in to comment.