Skip to content

Commit 1f95daf

Browse files
committed
Image Generation. Thats all I can do today sorry
1 parent 09ef765 commit 1f95daf

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

main.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ class __InvalidButtonAction(Exception): ...
324324
PH_DATA: list[str] | None = None
325325
POINTS: int = 0
326326
GEN_SF: int = 0
327+
CUR_IMAGE = None
327328

328329

329330
class Database:
@@ -831,6 +832,29 @@ def generate_new_screenshot(**kw) -> None:
831832
return
832833

833834

835+
def generate_new_image(**kw) -> str:
836+
"""
837+
# generate_new_image
838+
839+
Get an image from the selected data.
840+
841+
:param database: overwrite for CUR_DB *(should be of type Database)*
842+
843+
Returns:
844+
str: the link to the new image *(it also saves it as a global so it might not be necessary to get the returned value)*
845+
"""
846+
847+
global CUR_IMAGE
848+
849+
db: Database = kw.get('database', CUR_DB)
850+
851+
x = random.choice(db.structure[CUR_DATA[0]][CUR_DATA[1]][CUR_DATA[2]]['screenshots'].remove(CUR_IMAGE))
852+
CUR_IMAGE = x
853+
del x
854+
855+
return CUR_IMAGE
856+
857+
834858
def setup_play_screen():
835859
PLAY_ITEMS.heading = ttk.Label(PLAY_ITEMS, text='Play', font=HEADING1)
836860
PLAY_ITEMS.f1 = ttk.Frame(PLAY_ITEMS)

0 commit comments

Comments
 (0)