Describe gasp here...
(0, 0) is at the bottom left of the window. The window is 640 pixels by 480, by default. (You can make it a different size if you want to.) Coordinates are given in units of one pixel.
All functions that take coordinates take them as a tuple (x, y).
Circle((300, 200), 10) # :) This is good Circle(300, 200, 10) # :( This is bad
To access the color module GASP has to offer. Call color.* where * is the color you wish to call. For example: ` color.BLACK ` This is the color black. Check out the gasp color refrence chart to see all of the availble color options.
from gasp import * begin_graphics() ... # all of your code end_graphics()
These are the essentials. ` from gasp import * ` imports the gasp module, begin_graphics() starts the graphics window, and end_graphics() quits the graphics window and ends the program. It’s dead simple, but also dead necessary.
begin_graphics(width=800, height=600, title="My Game", background=color.YELLOW)
This creates a graphics window with the dimensions 800x600, a title of My Game , and a background color of yellow. With no arguments you get a white 640x480 graphics window titled Gasp .
Ends a graphics window.
Clears everything off of the graphics window. It looks like a new graphcs window as if you just called begin_graphics().
removes those objects from the screen
The objects that you will be displayed in your graphics window. You can manipulate these objects using the screen object methods
Plot(pos, color=color.BLACK, size=1)
It puts a dot on the screen.
Line(start, end, color=color.BLACK)
Creates a line on the screen.
Box(center, width, height, filled=False, color=color.BLACK, thickness=1)
This creates a Box on the screen
Polygon(points, filled=False, color=color.BLACK, thickness=1)
Creates a polygon on the screen
Circle(center, radius, filled=False, color=color.BLACK, thickness=1)
Draws a circle, its center is a set of coordinates, and the radius is in pixels. It defaults to not being filled and the color black.
Arc(center, radius, start_angle, end_angle, filled=False, color=color.BLACK, thickness=1)
Creates an arc on the screen.
Oval(center, width, height, filled=False, color=color.BLACK, thickness=1)
Puts an oval on the screen wherever you want.
Image(file_path, center, width=None, height=None):
Loads an image onto the screen. If you only pass a width and not a height it automatically scales the height to fit the width you passed it. It behaves likewise when you pass just a height.
The methods that manipulates screen objects
Move a screen object to a pos
move_by(obj, dx, dy)
Move a screen object relative to it’s position
Rotate an object to an angle
Rotate an object a certain degree.
Text(text, pos, color=color.BLACK, size=12)
Puts text on the screen