From 1581a2fa797cf770e12e407fa953782c9dae6680 Mon Sep 17 00:00:00 2001 From: Gijs Date: Sat, 8 May 2021 17:22:18 +0200 Subject: [PATCH] Adjusted path in examples. --- asciiWriter/examples/image_random_char.py | 4 +++- asciiWriter/examples/image_rotate.py | 4 +++- asciiWriter/examples/image_sentence.py | 5 +++-- asciiWriter/examples/multi_column_page.py | 4 +++- asciiWriter/examples/single_column_page.py | 4 +++- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/asciiWriter/examples/image_random_char.py b/asciiWriter/examples/image_random_char.py index cdb037c..13ac877 100644 --- a/asciiWriter/examples/image_random_char.py +++ b/asciiWriter/examples/image_random_char.py @@ -4,11 +4,13 @@ from asciiWriter.patterns import image from asciiWriter.utils import make_lines, visit, print_lines from asciiWriter.marks import random, single +from os.path import join, dirname + width = 75 height = 75 # Where to find the image -image_path = 'images/blobs-small.png' +image_path = join(dirname(__file__), 'data', 'blobs-small.png') # Construct the pattern image_pattern = image(image_path) # Set the marker, in this case it makes a random selection from diff --git a/asciiWriter/examples/image_rotate.py b/asciiWriter/examples/image_rotate.py index bdedc52..20b9c8c 100644 --- a/asciiWriter/examples/image_rotate.py +++ b/asciiWriter/examples/image_rotate.py @@ -10,11 +10,13 @@ from asciiWriter.patterns import image from asciiWriter.utils import make_lines, visit, print_lines, rotate from asciiWriter.marks import sentence, single +from os.path import join, dirname + width = 75 height = 75 # Where to find the image -image_path = 'images/blobs-small.png' +image_path = join(dirname(__file__), 'data', 'blobs-small.png') # Construct the pattern image_pattern = image(image_path) # Set the marker, in this case a sentence diff --git a/asciiWriter/examples/image_sentence.py b/asciiWriter/examples/image_sentence.py index b8245fd..262afc0 100644 --- a/asciiWriter/examples/image_sentence.py +++ b/asciiWriter/examples/image_sentence.py @@ -9,12 +9,13 @@ from asciiWriter.patterns import image from asciiWriter.utils import make_lines, visit, print_lines from asciiWriter.marks import sentence, space +from os.path import join, dirname + width = 75 height = 75 # Where to find the image -image_path = 'images/blobs-small.png' -image_path = 'images/shapes.png' +image_path = join(dirname(__file__), 'data', 'shapes.png') # Construct the pattern image_pattern = image(image_path) # Set the marker, in this case a sentence diff --git a/asciiWriter/examples/multi_column_page.py b/asciiWriter/examples/multi_column_page.py index cd3cf9b..00dbcf2 100644 --- a/asciiWriter/examples/multi_column_page.py +++ b/asciiWriter/examples/multi_column_page.py @@ -4,12 +4,14 @@ from asciiWriter.text import make_column, make_multi_column from asciiWriter.utils import merge, print_lines, make_lines, translate import math +from os.path import join, dirname + # Define width and height of the output width = 125 height = 27 # Import a text -text = open('texts/about.txt').read() +text = open(join(dirname(__file__), 'data', 'language.txt')).read() # Make an empty layers list layers = [] diff --git a/asciiWriter/examples/single_column_page.py b/asciiWriter/examples/single_column_page.py index 54a8caf..4c2ccf5 100644 --- a/asciiWriter/examples/single_column_page.py +++ b/asciiWriter/examples/single_column_page.py @@ -5,12 +5,14 @@ from asciiWriter.utils import merge, print_lines, make_lines, translate from hyphen import Hyphenator import math +from os.path import join, dirname + # Define width and height of the output width = 100 height = 500 # Import a text -text = open('texts/language.txt').read() +text = open(join(dirname(__file__), 'data', 'language.txt')).read() # Import a hyphenator h_en = Hyphenator('en_US')