organize code

This commit is contained in:
oleting
2020-12-27 20:36:35 +01:00
parent 7552c31ccf
commit 8a529cbe83
5 changed files with 49 additions and 46 deletions

View File

@@ -116,6 +116,6 @@ def draw_while_loop_back(condition: str, x: int, y: int, xsize: int, ysize: int)
#the x, y offset then the x,y draw size (the canvas)
return x + xsize * .1, y, xsize * .9
def NSD_save(filepath: str, filename: str):
def NSD_save(filepath: str):
"""Save the created file"""
img.save(filepath + '/' + filename + datei_endung ,"PNG")
img.save(filepath + datei_endung ,"PNG")

View File

@@ -1,9 +1,8 @@
import draw.code_to_image as cti
class NSD_writer(object):
def __init__(self, filepath: str, filename: str, x_sz: int, y_sz: int) -> None:
def __init__(self, filepath: str, x_sz: int, y_sz: int) -> None:
self.filepath = filepath
self.filename = filename
self.x_sz = x_sz
self.y_sz = y_sz
@@ -11,4 +10,4 @@ class NSD_writer(object):
cti.NSD_init(self.x_sz, self.y_sz)
def __exit__(self, _, __, ___):
cti.NSD_save(self.filepath, self.filename)
cti.NSD_save(self.filepath)