File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -324,6 +324,7 @@ class __InvalidButtonAction(Exception): ...
324324PH_DATA : list [str ] | None = None
325325POINTS : int = 0
326326GEN_SF : int = 0
327+ CUR_IMAGE = None
327328
328329
329330class 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+
834858def setup_play_screen ():
835859 PLAY_ITEMS .heading = ttk .Label (PLAY_ITEMS , text = 'Play' , font = HEADING1 )
836860 PLAY_ITEMS .f1 = ttk .Frame (PLAY_ITEMS )
You can’t perform that action at this time.
0 commit comments