Chapter 1. Introduction
Chapter 2. Using Kplot
Chapter 3. Tutorial
Appendix A. Python basics
Appendix B. Viewports and coordinates(world, viewport, normalised)
Appendix C. Examples
Kplot's documentation is inside Kplot itself. By using docstrings in Kplot you can get documentation from within the Python console itself.
>>> import Kplot >>> help(Kplot) >>> help(Kplot.Device) >>> help(Kplot.Panel) >>> help(Kplot.Line) |
Examples can be found here:
Appendix C. Examples
I recommend reading the Python tutorial first.
Sequences:
You should get familair with lists, tuples, they are both sequences,
tuple being immutable(can't be changed).
A sequence can be unpacked like this:
p1 = 1,2,3 p2 = (1, 2, 3) p3 = [1,2,3] x1, y1, z1 = p1 x2, y2, z2 = p2 x3, y3, z3 = p3 |
import Kplot p1 = 12, 15 p2 = (12, 15) p3 = [12, 15] p4 = Kplot.Vector(12, 15) # 2 arguments, 12 and 15 p5 = Kplot.Vector((12, 15)) # 1 argument a tuple (12, 15) p6 = Kplot.Vector(p3) # 1 argument, a list [12, 15] |
Namespaces
Python has a lot of packages, Kplot is also just a package. You can import it using 'import Kplot'
as you've seen above. This makes it very clear what package you are using because you
have to type <packagename>.<name>, but requires alot of typing.
using 'from Kplot import *' imports everything from the Kplot package into your local
namespace(of your script or console). I will demonstrate this using the builtin dir function.
>>> import Kplot >>> dir() ['Kplot', '__builtins__', '__doc__', '__name__'] >>> dir(Kplot) ['Arrow', 'Axis', 'Box', ' ... lotsa more ... 'Rectangle', 'Scatter', 'pgplot'] |
>>> from Kplot import * >>> dir() ['Arrow', 'Axis', 'Box', ' ... lotsa more ... 'Rectangle', 'Scatter', 'pgplot'] |
Appendix B. Viewports and coordinates(world, viewport, normalised)
soon, really soon :)