Posts Tagged ‘graphics’

Another Sketch Challenge: Puffin

December 6, 2020 3 comments

This week sketch challenge @1hour1sketch is to Draw a Puffin, so here is my sketch using pencil, Pen and water color..

Ali radwani drawing sketch challenge 1hour1sketch pen pencil Coloring watercolor

Python and Lindenmayer System – P2

November 3, 2019 1 comment

Learning : Lindenmayer System P2
Subject: Drawing with python using L-System

In the first part of Lindenmayer System L-System post (Click to Read) we had wrote two functions: one to generate the pattern based on the variables and roles, and one to draw lines and rotate based on the pattern we have.

In this part I will post images of what Art we can generate from L-System
the codes will be the L-system that generate the patterns, so the code will include: the Rules, Angle (Right, Left) Iteration and Starting Variable.

L-System: Koch Curve

L-System: Minkowski Sausage

L-System: … but here the Iteration is: 3

L-System: Again … but here the Iteration is: 3

L-System: Square Sierpinski

L-System: Sierpinski Arrowhead.

L-system: Dragon Curve

L-System: Koch Snowflake



The possibilities to generate the putters and therefore drawing the output is endless, any slightly changes in the iterations or rotation (+ -) angles will take all output to a new levels. In the coming post, I will use the L-system to generate fractal tree and see what we can get from there.

To Download my Python code (.py) files Click-Here

Follow me on Twitter..

Python Project: Ant Escaping Path

August 29, 2019 Leave a comment

Python simulation project
Python, Graphics and simulation

In this project we assume that we have a square pad and we put an ant in the center of this pad, we let the ant to walk, once it reach any eadgs of the square we move it with our hand to the middle again, say we doing this for x times and each time we colored the ant foots with gray level (light to dark) color. Our project is to write a code to simulate this task (ant movement). 

Enhancement: Here are some enhancement ideas:
1. We can use the Pi or Golden Ratio for the variables.
2. Also we can set a memory facto so with each time we move the Ant to the center the memory will increase so it may use the same path.
3. For the memory, we can set a position (x,y) as a food, and each time it reach the food it’s memory will increase.

The Code

# Create in 27/8/2019 .

import turtle
import random

screen = turtle.Screen()


# colors varibles
# r=240, g=240, b=240 is a light gray color


cf = 3 # color increasing factor
ff = 0 # ant forward moving factor

def rand_walk(x,the_t):


# The color will be darker each time



def ant_walk ():

x = 1

while x < 7 : # Moving the Ant to the center 7 times


if random.randrange(1,100) %2:

t_ang = random.randrange(10,45)



t_ang = random.randrange(10,45)

t1.left (t_ang)

# if the ant reach the square boards then we move it to the center.

if (t1.xcor() > 650 ) or (t1.xcor() 650 ) or (t1.ycor() < -650 ):



x = x + 1

# Calling the Function

Here is an GIF file

To Download my Python code (.py) files Click-Here

Follow me on Twitter..