Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Use pathlib and array comprehension for code list #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

christopherwoodall
Copy link

No description provided.

CodeFace = Image.open("./imgs/Face.jpg")
LeftArrow = Image.open("./imgs/LeftArr.png")
codes = "codes.txt"
code_list = Path(codes).read_text().splitlines()
Copy link
Author

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()
Copy link
Author

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
Copy link
Author

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]
Copy link
Author

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]
Copy link
Author

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]
Copy link
Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant