Catalogue of Posts

Thursday, August 27, 2020

Basic Graphics #3 - Angle

Using  -  The Python Computer Language
                Turtle Graphics Library


3.   ANGLE
ROTATION RIGHT
 
 
SAVE AS
 
>>> import turtle
>>>
>>> Pt = turtle.Turtle()
>>>
>>> Pt.right(45)
>>>
>>> turtle.done()
>>> 
 
SAVE
 
 

Pt.right(number of degrees)
    Arrow head turns around to its right     
    side   
 
The arrow head spins at its position,
    which is the pixel at its front point



ROTATION LEFT
 

SAVE AS
 
>>> import turtle
>>>
>>> Pt = turtle.Turtle()
>>>
>>> Pt.left(45)
>>>
>>> turtle.done()
>>> 
 
SAVE
 


Pt.left(number of degrees)
    Arrow head turns around to its left side
     
The arrow head spins at its position, 
    which is the pixel at its front point



ROTATED LINE
 
 
SAVE AS
 
>>> import turtle
>>>
>>> Pt = turtle.Turtle()
>>>
>>> Pt.right(120)
>>> Pt.forward(200)
>>>
>>> turtle.done()
>>> 
 
SAVE
 





Pt.right(number of degrees)
Pt.forward(number of pixels)
            x 1





ANGLE
 
 

SAVE AS
 
>>> import turtle
>>>
>>> Pt = turtle.Turtle()
>>>
>>> Pt.right(120)
>>> Pt.forward(200)
>>> Pt.right(120)
>>> Pt.forward(200)
>>>
>>> turtle.done()
>>> 
 
SAVE
 




Pt.right(number of degrees)
Pt.forward(number of pixels)
            x 2






TRIANGLE
 

SAVE AS
 
>>> import turtle
>>>
>>> Pt = turtle.Turtle()
>>>
>>> Pt.right(120)
>>> Pt.forward(200)
>>> Pt.right(120)
>>> Pt.forward(200)
>>> Pt.right(120)
>>> Pt.forward(200)
>>>
>>> turtle.done()
>>>
 
SAVE





Pt.right(number of degrees)
Pt.forward(number of pixels)
            x 3







USING THE OUTSIDE ANGLE


Pt.forward(number of pixels)
Pt.right(number of degrees)
    the line proceeds in the direction,
      - of, number of degrees, right,
      - from, the previous direction
         of the arrow






THE LOOP
 
 
When there is a repetition of
a sequence of actions,
instead of writing out the sequence,
a number of times,
it is easier to write it as a loop.
 
So,
 
Pt.right(120)
Pt.forward(200)
Pt.right(120)
Pt.forward(200)
 
Can be written, as the “for” loop  -
 
for i in range(2):
    Pt.right(120)
    Pt.forward(200)
 
i   means “integer”, “whole number”

  
Also,
 
Pt.right(120)
Pt.forward(200)
Pt.right(120)
Pt.forward(200)
Pt.right(120)
Pt.forward(200)
 
Can be written, as the “for” loop  -
 
for i in range(3):
    Pt.right(120)
    Pt.forward(200)

 
for i in range(number of times):
     sequence of actions
    number of times,
    is the number of times to do (loop)
    this sequence of actions 



(c) Katherine Stuart 2020
Dochas Books Film

Saturday, August 22, 2020

Basic Graphics #2 - Line

Using  -  The Python Computer Language
                Turtle Graphics Library


2.  LINE

FORWARD LINE


SAVE AS
 
>>> import turtle
>>>
>>> Pt = turtle.Turtle()
>>>
>>> Pt.forward(200)
>>>
>>> turtle.done()
>>> 
 
SAVE
 

Pt.forward(number of pixels)
    in the direction of the arrow head     
 
This line is  1  pixel wide

The length of the line is from the start    
    pixel to the pixel at the front point of 
    the arrow head
 
 

BACKWARD LINE


SAVE AS
 
>>> import turtle
>>>
>>> Pt = turtle.Turtle()
>>>
>>> Pt.backward(200)
>>>
>>> turtle.done()
>>> 
 
SAVE


Pt.backward(number of pixels)                                 
    in the opposite direction of the
    arrow head                                               
                                                                      ↓
This line is  1  pixel wide
The length of this line is from the start 
    pixel, to the pixel at the front point of
    the arrow head
 
 
 
FORWARD & BACKWARD LINE

 
SAVE AS
 
>>> import turtle
>>>
>>> Pt = turtle.Turtle()
>>>
>>> Pt.forward(200)
>>> Pt.backward(200)
>>>
>>> turtle.done()
>>> 
 
SAVE


Pt.forward(number of pixels)
    in the direction of the arrow head     
 
Pt.backward(number of pixels)                                 
    in the opposite direction of the
    arrow head                                            
                                                                      
 
 
LINE WIDTH


SAVE AS
 
>>> import turtle
>>>
>>> Pt = turtle.Turtle()
>>>
>>> Pt.width(10)
>>> Pt.forward(200)
>>>
>>> turtle.done()
>>> 

SAVE
 


Pt.width(number of pixels)
 
This line is 10 pixels wide



(c) Katherine Stuart 2020
Dochas Books Film 

Friday, August 21, 2020

Poem - "The Net"


 

The Net

For Friedrick


Twirling, twirling,
Round and round,
Circle spinning, 
Off the ground.

Through the air,
Nature abound,
Through the forest,
Whistling sound.

Where it lands,
I can only hope,
A bird or two,
In it's scope.

But yet, dismay,
Can it cope?
"Any luck?"
I answer, "Nope."

But that was then,
I was a child,
My brother tried,
My efforts, mild.

*

Things come to pass,
And this is now,
No longer child,
I may know how.

Throwing wide,
From pole to pole,
Deeper than ............ ,
My soul.

A hidden net,
High in the sky,
To catch a bird ............ ,
'Tis nigh.



(c) Katherine Stuart 2020
Dochas Books Film

Wednesday, August 19, 2020

Basic Graphics #1 - Point (and Screen)

 Using  -  The Python Computer Language  
                 Turtle Graphics Library

I have been working on a few computer programs
so that I can do some graphics for different projects.

The programs are very simple, 
and anyone who wants to start from scratch
to write computer programs, or do some graphics,
may find these useful.
                 

1.  POINT    (AND SCREEN)



SAVE AS

>>> import turtle             ENTER
>>>                           ENTER
>>> Pt = turtle.Turtle()      ENTER
>>>                           ENTER
>>> turtle.done()             ENTER
>>> 

SAVE
 

Pt is –

            At the default start position

            At the centre of screen

            At    0    The Origin

The curved side of the arrow head is the  

    back
The pixel at the front point of the arrow
    head, is its position



TO SET PYTHON UP ON YOUR COMPUTER
-    go to    https://www.python.org/downloads/
-    download the latest version of Python for your type of system
-    follow the prompts to install it on your system
Mine is Windows 10, so in Windows 10 -
-    access it by clicking on the "start" button on your task bar
     -    scroll down the program list until you get to "Python"
          -    click on "Python", and 4 items will appear       
               -    IDLE    - this is the file that you write programs in
               -    Python    - this is the file that you run your programs in
               -    Python Manuals    - information on how to use Python
               -    Python Module Docs    - lists of programs within Python
          -    click on IDLE
               -    the IDLE file will come up
               -    Save your file using the drop down menu "file" at the top,
                     following the prompts, into a folder
               -    type your program in this file
               -    when you type in -    xxxx = turtle.Turtle() 
                     a basic window with an arrow head in it will appear behind your IDLE file
               -    move the window to the side of your IDLE file so that you can see it
               -    finish typing in your program
               -    Save your program
-    click on the "start" button on your task bar
     -    scroll down to, then click on, "Snip and Sketch"
          -    take a "Snip and Sketch" of  your finished window
               and save it into a folder
The images above are "Snip and Sketch"

PROGRAMS
The program above, and the ones following in other posts,
are my ideas, from the video below that I've been learning from.
:)


HAPPY COMPUTER PROGRAMMING  :)



Black Framed Images, and Text (c) Katherine Stuart 2020
Dochas Books Film