Chapter 9 Subroutine
Chapter 10 Array
Chapter 8 Turtle Graphics
- Moving and drawing
- Drawing square
- Changing color
Chapter 6 Beginning graphics
Showing graphicsWindow
GraphicsWindow.Show()
Setting up graphics window
Graphicswindow.backgroundcolor = "SteelBlue"
Graphicswindow.Title = "My Graphic Window"
GraphicsWindow.Width = 320
GraphicsWindow.Height = 200
GraphicsWindow.show()
We can draw line, shapes, text and picture.
Drawing lines
Example drawing line:
GraphicsWindow.DrawLine(0,0,10,10)
Drawing shapes:
Shapes = rectangle, ellipse, triangle
Example drawing rectangle:
GraphicsWindow.DrawRectangle(100,100,10,10)
Example drawing ellipse
GraphicsWindow.DrawEllipse(10,10,100,100)
Example drawing triangle
GraphicsWindow.drawtriangle(200,200,300,300,400,400)
Change shapes line color:
graphicswindow.
Filling shapes
Shapes = rectangle, ellipse, triangle
Example filling rectangle shapes:
GraphicsWindow.fillrectangle(
Example filling ellipse shapes:
GraphicsWindow.fillellipse(
Example filling triangle ellipse
Change shapes brush color
GraphicsWindow.Brushcolor = "Green"
Usage:
GraphicsWindow.Drawline(starting x coordinates, starting y coordinate, ending x coordinate, ending y coordinate)
Example:
- Changing pen color
GraphicsWindow.pencolor = "Green"
or
GraphicsWindow.pencolor = #FF0000
- Changing pen thickness
GraphicsWindow.PenWidth = 10
- Drawing and filling shapes
Draw operations, and
Filling operations
Draw operations: draw the outline of the shape using a pen
Filling opearations: paint the shape using brush
Chapter 5 Loops
there are usually several ways of doing the same thing.
1. For.. Endfor
For loops run for a pre-defined number of times.
For i = 0 to 4
textwindow.writeline(i)
endfor
for i = 0 to 4 step 2
textwindow.writeline(i)
endfor
2. While loop
While loop runs until a given condition achieved / true.
Chapter 4 Conditions and branching
If(condition) then ... endif
If(condition) then ... endif
Chapter 3
Chapter 2 Understanding Our First Program
Chapter 1