Chapter 7 Flashcards

1
Q

Graphics

A

Discipline that underlies the representation and display of geometric
shapes in two‐ and three‐dimensional space

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Turtle Graphics

A

Toolkit provides a simple and enjoyable way to draw pictures
in a window
- turtle is a non-standard, open-source Python module

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How did turtle graphics originally develop?

A

I was part of the children’s programming language Logo
- Created by Seymour Papert and his colleagues at MIT in the late 1960s
- Analogy: Turtle crawling on a piece of paper, with a pen tied to its tail
* Sheet of paper is a window on a display screen
* Position specified with (x, y) coordinates- Cartesian coordinate system, with origin (0, 0) at the center of a window

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Heading

A

Specified in degrees, the heading or direction increases in value as
the turtle turns to the left, or counterclockwise. Conversely, a
negative quantity of degrees indicates a right, or clockwise, turn. the
turtle is initially facing east, or 0 degrees. North is 90 degree.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

color

A

Initially black, the color can be changed to any of more than 16
million other colors.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Width

A

This is the width of the line drawn when the turtle moves. The initial
width is 1 pixel.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Down

A

This attribute, which can be either true or false, controls whether the
turtle’s pen is up or down. When true (that is, when the pen is down),
the turtle draws a line when it moves. When false (that is, when the
pen is up), the turtle can move without drawing a line.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Interface

A

set of methods of a given class
- Used to interact with an object
- Use docstring mechanism to view an interface
help(<class>)
help(<class>.<method>)</method></class></class>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Turtle graphics configuration file (turtle.cfg) contains initial settings of several attributes which are?

A

Turtle, Screen, and Canvas objects
- Python creates default settings for these attributes
- to open a file with these settings: Open a text editor, enter the settings, and save the file as turtle.cfg

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What must you do before applying methods to an object?

A

create the object (i.e., an instance)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

instantiation

A

process of creating an object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Use a ____ to instantiate an object

A
  • constructor
    syntax:

<variable> = <class>(<any>)
for Turtle class:
t = Turtle()
</any></class></variable>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

To close a turtle’s window, click its ___ box

A

close
- attempting to manipulate a turtle whose window has been closed raises an
error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Vector graphics

A

Drawing of 2 dimensional shapes, such as rectangles, triangles, and circles

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Mutator methods

A

methods that change the internal state of a Turtle object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Accessor methods

A

methods that return the values of a Turtle object’s
attributes without altering its state

17
Q

Manipulating a Turtle’s screen

A
  • Access a turtle’s Screen object using the notation t.screen
  • Then call a Screen method with this object
  • Methods window_width() and window_height() can be used to locate the
    boundaries of a turtle’s window
18
Q

Pixels

A

The colored dots called picture elements that make up the display area on a computer screen
- ach pixel represents a color – the default is black - Change the color by running the pencolor method

19
Q

RGB

A

common system for representing colors
- stands for red, green and blue
- Each color component can range from 0 – 255
* 255 - max saturation of a color component
* 0 - total absence of that color component
- a true color system
- Each color component requires 8 bits; total number of bits needed to represent
a color value is 24

20
Q

What is the total number of RGB colors?

A

2^24 (16,177,216)

21
Q

The Turtle class includes a ___ method for changing the turtle’s drawing color

A
  • pencolor
  • expects integers for the three RGB components