-
Notifications
You must be signed in to change notification settings - Fork 1
Use pathlib and array comprehension for code list #1
base: main
Are you sure you want to change the base?
Conversation
CodeFace = Image.open("./imgs/Face.jpg") | ||
LeftArrow = Image.open("./imgs/LeftArr.png") | ||
codes = "codes.txt" | ||
code_list = Path(codes).read_text().splitlines() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple 1 liner to read a file and split by new line. This will put all the codes into the 'code_list' list/array.
RightArrow = Image.open("./imgs//RightArr.png") | ||
|
||
# Settings | ||
app = Tk() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move 'app' into Settings IOT keep like variables in the same location and make it a bit easier to find.
@@ -1,64 +1,64 @@ | |||
#!/bin/python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Should really be '#!/usr/bin/env python3'.
def next(): | ||
SF = int(Start_from.get()) | ||
SF = SF+1 | ||
current_code['text']= list[SF] | ||
current_code['text'] = code_list[SF] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename 'list' to 'code_list' so that we are not over writing default types.
Start_from.delete(0, "end") | ||
Start_from.insert(0, SF) | ||
|
||
def pre(): | ||
SF = int(Start_from.get()) | ||
SF = SF-1 | ||
current_code['text']= list[SF] | ||
current_code['text'] = code_list[SF] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename 'list' to 'code_list' so that we are not over writing default types.
Start_from.delete(0, "end") | ||
Start_from.insert(0, SF) | ||
|
||
def SET(): | ||
SF = int(Start_from.get()) | ||
current_code['text']= list[SF] | ||
current_code['text'] = code_list[SF] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename 'list' to 'code_list' so that we are not over writing default types.
No description provided.