Rev | Line | |
---|
[1081] | 1 | import sys
|
---|
[1078] | 2 | import frams
|
---|
| 3 |
|
---|
[1087] | 4 | frams.init(*(sys.argv[1:])) # pass whatever args we have, init() is the right place to deal with different scenarios:
|
---|
[1085] | 5 | # frams.init() - should try to figure out everything (and might fail)
|
---|
[1087] | 6 | # frams.init('path/to/lib') - load the library from the specified directory and configure Framsticks path as "data" inside this directory
|
---|
| 7 | # frams.init('path/to/lib','-d/tmp/workdir/data') - as above, but set the working (writable) directory somewhere else (see also -D)
|
---|
| 8 | # frams.init('path/to/lib','-Lframs-objects-alt.dll') - use specified library location and non-default file name
|
---|
[1078] | 9 |
|
---|
| 10 | print('Available objects:', dir(frams))
|
---|
| 11 | print()
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | def extValueDetails(v):
|
---|
| 15 | return '"' + str(v) + '" frams type=' + str(v._type()) + ' frams class=' + str(v._class()) + ' python type=' + str(type(v._value()))
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 | v = frams.String.deserialize('[100,2.2,"abc",[null,[]],XYZ[9,8,7]]')
|
---|
| 19 | print(extValueDetails(v))
|
---|
| 20 | for e in v:
|
---|
| 21 | print(extValueDetails(e))
|
---|
| 22 |
|
---|
| 23 | g = frams.GenePools[0].add('X')
|
---|
| 24 | g.name = "py!"
|
---|
| 25 | g.data['custom'] = 123.456
|
---|
| 26 | g.data['a'] = 'b'
|
---|
| 27 |
|
---|
| 28 | for more in range(5):
|
---|
| 29 | frams.GenePools[0].add(frams.GenMan.mutate(g.geno))
|
---|
| 30 |
|
---|
| 31 | for g in frams.GenePools[0]:
|
---|
| 32 | print(str(g.index) + '. "' + str(g.name) + '" ' + str(g.genotype) + ' data=' + str(g.data))
|
---|
Note: See
TracBrowser
for help on using the repository browser.