示例#1
0
def exercise():
    c = example.Circle(10)
    c.x = 20
    c.y = 30

    s = example.Square(10)
    s.x = -10
    s.y = 5

    forever = "--forever" in sys.argv[1:]
    while True:
        boost_python_swig_args_ext.show(c.this)
        boost_python_swig_args_ext.show(s.this)
        if (not forever): break
示例#2
0
# file: runme.py

# This file illustrates the proxy class C++ interface generated
# by alaqil.

import example

# ----- Object creation -----

print "Creating some objects:"
cc = example.Circle(10)
c = example.ShapePtr(cc)
print "    Created circle", c
ss = example.Square(10)
s = example.ShapePtr(ss)
print "    Created square", s

# ----- Access a static member -----

print "\nA total of", example.cvar.Shape_nshapes, "shapes were created"

# ----- Member data access -----

# Set the location of the object

c.x = 20
c.y = 30

s.x = -10
s.y = 5
示例#3
0
def test_vector():
    b = [1, 2, 3]
    print("b^2 = {}".format(example.Square(b)))
    c = [4.0, 5.0, 6.0]
    print("c^2 = {}".format(example.Square(c)))