-
Notifications
You must be signed in to change notification settings - Fork 1
Home
I have tried to make this documentation as comprehensive and easy to understand as I could. If there are any questions, feel free to mail me at the address provided in the footer or post an issue on the issues tab.
Let's start by importing goopylib into our code. There are quite a few ways to do this:
from goopylib.imports import * # Imports Everything in the Package
However, you may not need to use everything in goopylib. In which case, you can import all the important objects like so:
# Imports all GraphicsObjects, and the Point & Window class.
from goopylib.objects.imports import * # Omits the Maths, Sound, & Physics subpackages as well as styles & colours
If you need access to certain subpackages, these can be used:
from goopylib.math.imports import * # Everything from goopylib subpackages
from goopylib.sound.imports import *
from goopylib.physics.imports import *
Next, look at how you create a window with goopylib.
This graphics library is object-orientated and is divided into the classes linked to below. I categorize these classes into 3 sections: Primitive, Compound, and Other. Primitive classes are the most basic classes; all the compound classes require them to work. These would include the most basic geometrical shapes like Polygons & Ellipses and slightly more complex widgets and objects such as Images & Entries.
The Compound classes, as their name suggest, are made from 1 or more Primitive class. Take Buttons - you can make a button from any Primitive class. Do you want to make a polygon a button? a circle? an image? go ahead. Similarly, for classes like the Checkbox & Radiobuttons, you can either supply a Primitive object and create a Checkbox or Radiobutton out of them... or you could also supply a Button!
The other classes aren't exactly Graphics Objects, they just sort of help with creating the Graphics Objects. This would include the Window class which helps you draw objects on top, or the Point class which helps you position objects.
- GraphicsObject - This is a general class for all primitive-objects.
- Rectangle - This class lets you create, you guessed it, rectangles & squares.
- Oval - A class for creating ellipses.
- Circle - A child class of the oval to create circles.
- Polygon - Create shapes with more vertices!
- Line - Create Lines!
- Arc - Create Arcs!
- Image - Built on top of PIL.
- Text - Use this to add text to your application and customize the font, colour, style, and more!
- Entry - Need an input from the user? Use this.
- Button - Makes the work of creating and animating a Button easy.
- CheckBox - Adding a settings page? You can add Checkboxes!
- CycleButton - Unlike the Checkbox, These give you more than 2 states.
- RadioButton - Perfect for Multiple Choice Selection related functions.
- SlideBar - Create a modern-looking Slider to take input from the user!
- Window - This creates a window for you to draw the other objects on
- Point - This helps position the objects on the window
There are a lot of options that you can specify in Goopylib and so, to make it easier for everyone to get an idea of what they are, here is some documentation containing examples and lists of options:
But, goopylib is not limited to just this. This next part might not be for everyone, but if you ever require vector graphic functions or easing for your animations, goopylib provides mathematical functions for help with animations and vector graphics:
-
[Polygon Triangulation]
-
[Interpolation Functions]
- [Sound Class]
Feel free to use this library in any of your projects and let me know about them!
Contact Author: bhavyemathur@gmail.com