Categories
Drawing Adinkra Symbols using Python

Aban

Aban means “fortress”. It is the symbol of strength and authority.

We will use the 5 pixel grid to trace out this image. The image of this is shown below:

Aban on a Grid

Analysing the Symbol

The symbol is a composite symbol made up of 4 symbols that look like tongs.

A single tong is symmetrical in its quadrant. This property means that we draw a tong and use the steps to draw others.

The Plan to Draw the Symbol

We shall move the pen to the position (0, 80). Once we do this, we shall set the heading of the pen to 45 degrees thus drawing the tong in the upper right quadrant.

Once the drawing of the first tong is completed, the position of the turtle will place it on the x axis on the right.

At that point, we simply set the heading of the pen to 315 degrees and draw the second tong. When the second tong is drawn, the turtle will be on the negative y axis.

At this point, we simply set the heading of the pen to 225 degrees and draw the third tong. When the third tong is drawn, the turtle will be on the negative x axis.

At this point, we simple set the heading of the pen to 135 degrees and draw the fourth tong thus completing our shape.

Algorithm to Draw the Symbol

The algorithm to draw the Aban symbol is shown below:

  1. Lift up the pen
  2. Set the heading to 45 degrees
  3. Move the pen to the position (0, 80)
  4. Set the pen size to half the width of the shape
  5. Place the pen down
  6. Move forward to draw the first line
  7. Turn right by 90 degrees
  8. Move forward to draw half of the first line
  9. Turn left by 90 degrees
  10. Move forward to draw the protruding line at a distance of 5/8 of the length
  11. Lift up the pen
  12. Reverse the turtle by moving back the same distance as you moved forward
  13. Turn right by 90 degrees
  14. Place the pen down
  15. Draw the second half of the line
  16. Turn right by 90 degrees
  17. Move forward to draw the third line
  18. Change the heading to 315 and repeat steps 6 – 17
  19. Change the heading to 225 and repeat steps 6 – 17
  20. Change the heading to 135 and repeat steps 6 – 17

Using Turtle Graphics

We will use the template.py file and rename it to aban.py.

The code for steps 1 to 3 is given below:

turtle.penup()
turtle.setheading(45)
turtle.setposition(0, 80)

In step 4 of the algorithm to draw Aban, we have to find the width of the shape. We will also need to find the length of the shape.

To find the width of the line, we need to find the distance between two parallel points it passes through and this are: (120, 0) and (40, 80).

To find the length of a side of the Aban symbol, we take the point (0, 80) as our starting point and get the coordinates of the centre point (80, 160) which is where a line drawing the symbol would stop and turn.

We have to introduce a function coordinateDistance to give us the distance between the two coordinates. The function definition is shown below:

def coordinateDistance(x1, y1, x2, y2):
dx = x1 – x2
dy = y1 – y2
D = math.sqrt((dx * dx) + (dy * dy))
return D

To find the width and length, we use the expressions below:

width = coordinateDistance(120, 0, 40, 80)
length = coordinateDistance(0, 80, 80, 160)

The code for steps 4 and 5 is shown below:

turtle.pensize(width / 2)
turtle.pendown()

Since steps 6 to 17 will be repeated 3 more times, they are a good candidate for a function. We shall call this function drawTong.

Steps 6 to 17 can be automated using the drawTong function. We will first write out the commands for the steps to check then we will later integrate them into the drawTong function.

The code for steps 6 to 10 is given below:

turtle.forward(length)
turtle.right(90)
turtle.forward(length / 2)
turtle.left(90)
turtle.forward(length * 5 / 8)

The generated image is shown below:

Half Tong
Half Tong

The code to lift the pen is straightforward enough. To reverse the shape, we need to move backward the same number of steps as forward.

The code to do this is shown below:

turtle.penup()
turtle.backward(length * 5 / 8)
turtle.right(90)
turtle.pendown()
turtle.forward(length / 2)
turtle.right(90)
turtle.forward(length)

The generated image is shown below:

Full Tong
Full Tong

Now that we have drawn one part of the symbol, we can use the code to create the drawTong function so that we don’t have to repeat ourselves.

The code for the function is shown below:

def drawTong():
turtle.forward(length)
turtle.right(90)
turtle.forward(length / 2)
turtle.left(90)
turtle.forward(length * 5 / 8)
turtle.penup()
turtle.backward(length * 5 / 8)
turtle.right(90)
turtle.pendown()
turtle.forward(length / 2)
turtle.right(90)
turtle.forward(length)

To draw the shape completely, we need to call this function and alternate with the setheading angle that is representative of the quadrant the function will draw in. The code to do this is shown below:

drawTong()
turtle.setheading(315)
drawTong()
turtle.setheading(225)
drawTong()
turtle.setheading(135)
drawTong()

The generated image is shown below:

Completed Symbol
Completed Symbol

Complete Code

"""
Project Name: Drawing Adinkra Symbols using Python
Developer Name: Truston Ailende
Email Address: trustonailende@gmail.com
"""
import turtle
import math

# Square
def drawSquare(length):
    turtle.penup()
    turtle.setposition(-length/2.0, length/2.0)
    turtle.pendown()
    for i in range(0, 4):
        turtle.forward(length)
        turtle.right(90)
    turtle.penup()
    turtle.home()

# Horizontal lines
def drawHorizontalLine(length, division):
    pixelSpace = int(length / division)
    half = int(length / 2)
    for j in range((-half + pixelSpace), half, pixelSpace):
        turtle.penup()
        turtle.setposition(-half, j)
        turtle.pendown()
        turtle.forward(length)
    turtle.penup()
    turtle.home()

# Vertical lines
def drawVerticalLine(length, division):
    pixelSpace = int(length / division)
    half = int(length / 2)
    turtle.right(90)
    for k in range((-half + pixelSpace), half, pixelSpace):
        turtle.penup()
        turtle.setposition(k, half)
        turtle.pendown()
        turtle.forward(length)
    turtle.penup()
    turtle.home()

# Draw the grid
drawSquare(400)
drawHorizontalLine(400, 40)
drawVerticalLine(400, 40)

# Change the colour mode
turtle.colormode(255)

# Change the pencolor to red
turtle.pencolor(255, 0, 0)

# Draw the horizontal centre line
turtle.setposition(-200, 0)
turtle.pendown()
turtle.forward(400)
turtle.penup()

# Draw the vertical centre line
turtle.setposition(0, 200)
turtle.setheading(270)
turtle.pendown()
turtle.forward(400)

# Reset all the properties
turtle.home()
turtle.pencolor(0, 0, 0)

# Place code here
turtle.penup()
turtle.setheading(45)
turtle.setposition(0, 80)

def coordinateDistance(x1, y1, x2, y2):
    dx = x1 - x2
    dy = y1 - y2
    D = math.sqrt((dx * dx) + (dy * dy))
    return D

width = coordinateDistance(120, 0, 40, 80)
length = coordinateDistance(0, 80, 80, 160)

turtle.pensize(width/2)
turtle.pendown()

def drawTong():
    turtle.forward(length)
    turtle.right(90)
    turtle.forward(length / 2)
    turtle.left(90)
    turtle.forward(length * 5 / 8)
    turtle.penup()
    turtle.backward(length * 5 / 8)
    turtle.right(90)
    turtle.pendown()
    turtle.forward(length / 2)
    turtle.right(90)
    turtle.forward(length)

drawTong()
turtle.setheading(315)
drawTong()
turtle.setheading(225)
drawTong()
turtle.setheading(135)
drawTong()

# End the program
turtle.done()

Where Can It Be Found?

A brief Google search led me to the following places where you can get branded Aban products:

  1. Aban Zanzibar Trinity Rings on Simbasante
  2. Socks by Adinkra Republic
  3. Protection Adinkra Earrings by Ahima
  4. Aban Gold Pendant on Amazon
  5. Aban Wooden Stamp on Etsy

Summary

At the end of this post, we have successfully used the Python Turtle environment to draw the Aban symbol.

The code for this series is available on GitHub. Please feel free to check it out.

Next time, we will look at the Abusua Pa Adinkra symbol

Support this Series

Using the Adinkra symbols, I created the Adinkra Notebooks Collection.

You can support this series by buying one of them.

Categories
Drawing Adinkra Symbols using Python

Drawing Adinkra Symbols using Python – Introduction

I was privileged to live in Ghana for 15 months of my life. All around me I would see these symbols which I didn’t know what they meant and one day I would ask my Ghanaian friends their meaning.

What would follow would be an exposition into the heart of Ghanaian culture. Sadly, that culture is dying. This isn’t just true for Ghanaian culture but African culture in general.

The reason I believe is that at present, our culture contributes nothing meaningful to our lives. What’s the use of culture if you can’t feed yourself. Sadly, everywhere you look, Africans are at the bottom of the totem pole.

Yet, that culture is relevant to today’s realities. I am a graduate of Systems Engineering from the University of Lagos and I would say that my understanding of my culture was made more meaningful to me from my studies.

There are many forms of power in this world. The strongest of which is identity. When you know who you are, you will reject anything else and the world will either conform to you or eliminate you but while you live, you will dictate your terms.

I am an Esan man from Edo state in Nigeria. A descendant of the last men to surrender to the British in the Southern Protectorate that would later become Nigeria.

Knowing this, I expect myself to lead and on the hard days, I remind myself of who I am.

That is the strength an identity gives you. Why African culture doesn’t do the same is simply because we have never sought to truly understand it.

Most of what we call culture in Africa is dogma. Whenever you ask the practitioners the reasons for some cultural belief, there is no explanation other than: “It’s our culture”.

Such an approach repels most people who only see the rites but cannot connect to their meaning. Rather than acceptance, such an attitude breads contempt.

I only got to learn about the Adinkra symbols because the Ghanaians were open about it. If my friends had kept quiet, I would never have discovered the beauty, minimalism and symmetry of the Adinkra symbols.

This series “Drawing Adinkra Symbols using Python” will look at 40 Adinkra symbols and my attempt to draw them using the Python programming language. It is a rewrite of a series on my old blog.

I will be using Python 3. In the old blog, I created the code using Python 2. I intend to optimize the code as much as I can.

For a quick introduction to the Python programming language, please check out my fifth book: “Learn Python In One Week“.

I will be drawing 40 symbols in all. This symbols are the easiest to draw because they are made up of lines and circular curves.

Using Turtle Graphics

Before we can draw the symbols satisfactorily, we need to use a grid to analyse the symbols.

A grid will be drawn over the images of the symbols and we will be attempt to reproduce the image on our own grid.

The base images are 200 X 200 pixels. I will be drawing on a grid of 400 X 400 pixels.

The commands we will be using are:
1. import turtle
2. turtle.penup()
3. turtle.setposition(x coordinate, y coordinate)
4. turtle.pendown()
5. turtle.forward()
6. turtle.right(degree)
7. turtle.left(degree)

Please check out the Python documentation if you need to know the meaning of the commands.

The source file should be saved as template.py because we will use this file to draw the other symbols.

The code is shown below:

"""
Project Name: Drawing Adinkra Symbols using Python
Developer Name: Truston Ailende
Email Address: trustonailende@gmail.com
"""
import turtle
import math

# Square
def drawSquare(length):
    turtle.penup()
    turtle.setposition(-length/2.0, length/2.0)
    turtle.pendown()
    for i in range(0, 4):
        turtle.forward(length)
        turtle.right(90)
    turtle.penup()
    turtle.home()

# Horizontal lines
def drawHorizontalLine(length, division):
    pixelSpace = int(length / division)
    half = int(length / 2)
    for j in range((-half + pixelSpace), half, pixelSpace):
        turtle.penup()
        turtle.setposition(-half, j)
        turtle.pendown()
        turtle.forward(length)
    turtle.penup()
    turtle.home()

# Vertical lines
def drawVerticalLine(length, division):
    pixelSpace = int(length / division)
    half = int(length / 2)
    turtle.right(90)
    for k in range((-half + pixelSpace), half, pixelSpace):
        turtle.penup()
        turtle.setposition(k, half)
        turtle.pendown()
        turtle.forward(length)
    turtle.penup()
    turtle.home()

# Draw the grid
turtle.speed(1000000)
drawSquare(400)
drawHorizontalLine(400, 40)
drawVerticalLine(400, 40)

# Change the colour mode
turtle.colormode(255)

# Change the pencolor to red
turtle.pencolor(255, 0, 0)

# Draw the horizontal centre line
turtle.setposition(-200, 0)
turtle.pendown()
turtle.forward(400)
turtle.penup()

# Draw the vertical centre line
turtle.setposition(0, 200)
turtle.setheading(270)
turtle.pendown()
turtle.forward(400)

# Reset all the properties
turtle.home()
turtle.pencolor(0, 0, 0)

# Place code here

# End the program
turtle.done()

Check out the GitHub repository for all the code for this series.

The code shown above creates a grid of 400 X 400 pixels and resets the turtle to be at the origin of the window when the program finishes running.

The generated image is shown below:

Grid to Draw Adinkra Symbols

Where Can They Be Found?

Adinkra Symbols are ubiquitous in Ghana, a beautiful West African country on the Atlantic, situated between Cote d’Ivoire and Togo.

On cloth and walls, in pottery and logos, these Asante tribe symbols can be found everywhere.

I would first notice them in a church.

Summary

This post has introduced the series “Drawing Adinkra Symbols using Python” which has the aim to draw 40 Adinkra symbols using the Python programming language.

There are a large number of Adinkra symbols but 40 were chosen because the are the easiest to analyse and draw.

Each of the motifs that make up the corpus of Adinkra symbolism has a name and meaning derived either from a proverb, an historical event, human attitude, animal behaviour, plant life, forms and shapes of inanimate and man-made objects.

There are evocative messages in them that carry traditional wisdom. The beliefs, history, and philosophy of the Akan people is also represented by them.

They are still relevant because the corpus of symbols covers all aspects of life in terms of values and the collective knowledge of a people that has been handed over from antiquity.

Support this Series

Using the Adinkra symbols, I created the Adinkra Notebooks Collection.

You can support this series by buying one of them.