You are on page 1of 26

A BRIEF COURSE ON

Microsoft Windows
Logic-Oriented
Graphic-Oriented
INTRODUCTION

Microsoft Windows Logic –Oriented Graphic-Oriented (MSW LOGO) is


an interpreted language based on Logo, with a GUI front end. It
was developed by George Mills at MIT. It is generally used for
educational purpose.
This course is designed to give you a basic understanding of the
working of MSW LOGO and it’s commands. As you will go through
this course you will find it really easy and interesting.
INTRODUCTION TO GUI Drawing
Window

In the GUI of MSW LOGO, you


will see two windows:

The first one (The upper one) is


drawing window in which
you will draw something.

The second one (The lower


one) is command window
in which you will write the
command.
Command
Window
DRAWING WINDOW
In the drawing window on the top left
corner you will get following options:

1-File:- This option is used to start new


project, save the current project and
open the existing project.

2-Bitmap:- If you want to use an image


background in your drawing then you can
use open a Bitmap image trough this
option and put it into the background.

3-Set:- This is used to change the pen size,


pen width, screen color, font style etc.

4-Zoom:- As the name suggest, this option


can be used to zoom in and zoom out on
your drawing.
COMMAND WINDOW

We will write commands in the command line, i.e., the text box at the
bottom of the Commander Window. To execute or run these
commands, press Enter or click the Execute Button. We can also write
and run more than one command online at a time.
The command history will appear in the gray box. Click a line in the
history to make it jump to the respective command line, then we can
make changes (if required). Once this is done, press Enter or click the
Execute Button.
CONCEPT OF DRAWING IN MSW LOGO

 In the centre of drawing window you will see a small triangle. This triangle is called
turtle.
We enter the commands to move the turtle on the screen.
As the turtle moves, it draws on the screen.

BASIC COMMANDS
Forward or FD :-The most basic command of the MSW LOGO is forward
command. It moves the turtle in the direction of it’s nose.

Syntax:- Forward (pixels to move) or fd (pixels to move)

Example:- Forward 100 or fd 100


Backward or bk :-The most basic command of the MSW LOGO is backward
command. It moves the turtle in the direction of it’s nose.

Syntax:- back (pixels to move) or bk(pixels to move)

Example:- back 100 or bk 100

Clearing or cs :-The cs command clears the entire screen and moves the turtle
to its initial starting position
DRAWING STRAIGHT LINES

The command forward 100 or fd 100 moves the turtle 100


steps forward:

With the command back 100 or bk 100, you can move the turtle
backwards by 100 steps:
 Right or rt :-The most basic command of the MSW LOGO is right direction
command. It moves the turtle in the direction of it’s nose.

Syntax:- right(turn right according to the angle) or rt(turn right according to the
angle)

Example:- right 90 or rt 90

 left or lt :-The most basic command of the MSW LOGO is left direction
command. It moves the turtle in the direction of it’s nose.

Syntax:- left(turn left according to the angle) or lt(turn left according to the
angle)

Example:- left 90 or lt 90
Logo – Controlling the Turtle & Pen
 Logo has a number of other drawing commands, some of which are given below.
 pu – penup
 pd – pendown
 setpensize
Penup or pu :-means pick pen up, so you can move turtle without leaving tracks.
Syntax:- penup(forward or backward) or pu(fd or bk)

Example:- pu fd 30 , pu bk 30

Pendown or pd :-means pick pen down, so you can move turtle and leave tracks.
Syntax:- pendown(forward or backward) or pd(fd or bk)

Example:- pd fd 30 , pd bk 30
setpensize :- means it can make the pen larger, easier to see . Default pen size is [1 1]
ADDITIONAL DRAWING
COMMANDS
Logo has a number of other additional drawing commands, some of these are given
below.
 label
 setxy
Label command :-Label command takes a single word as a quoted string
(e.g.”a_string”) or a list of words in [] brakets without quotation(e.g.[a string of
letters]) and print them on the grapics window at the location of the turtle.
Setxy command :- The setxy command takes two arguments, treats as the value of the
abscissa( horizontal axis) and the second as a value of the ordinate (vertical axis). It places
the turtle coordinates, possibly leaving ink while reaching these coordinates .
Logo – Repetition :- Repeat command saves our time of typing-in to make The
general form is : repeat number [commands]. We must use the keyword - repeat
followed by a number and then sequence of commands in [ square brackets]
Logo – Randomization :- If you want a random angle between 0 to 359 degrees
.you can use random 360 to produce it.
Logo – Recursive Procedures

In a recursive procedure, there will be a recurrence call of the procedure within the
procedure. Let us consider the following code:
to spiral_recur :n
if :n < 1 [stop]
fd :n
rt 20
spiral_recur 0.95 * :n
end
EXAMPLE
Logo – Color
On Logo's Set menu, we can set the color of three screen elements
 The turtle's pen
 The turtle's fill (like a paint bucket for enclosures)
 The screen background
STEPS
You can make a colored square using the following steps:
 Step 1: Draw the square with side length 40 using the following command.
repeat 4 [fd 40 rt 90]
 Step 2: Pen up using the following command.
pu
 Step 3: Go to a point inside the square. For example, place the turtle at coordinate
(20, 20) using the following command.
setxy 20 20 Logo
 Step 4: Fill the square with the set floodcolor. For example, to set the floodcolor to
blue use the following command.
setfloodcolor [0 0 255]
Try executing the following set of commands –
 cs – To clear the screen.
 home – To bring the turtle at the home place.
 setpensize [5 5] – Setting the pen size.
 setpencolor [255 0 0] – Setting the pen color to red.
 setfloodcolor [0 0 255] – Setting the flood color to blue.
 setscreencolor [0 255 0] – Setting the screen color to green.
 repeat 4 [fd 40 rt 90] – Draw a square with side length 40.
 pu – Pen up.
 setxy 20 20 – Put the turtle at coordinate (20, 20).
 fill – Fill the square with the set floodcolor blue.
 ht – Hide turtle.

You might also like