Updated pykl Prototype (markdown)

Matthias Köfferlein 2018-06-20 23:23:27 +02:00
parent 68c3f61d1a
commit 40df9286dc
1 changed files with 21 additions and 21 deletions

@ -3,20 +3,20 @@ The prototype is found in the [pymod branch](https://github.com/klayoutmatthias/
## Building
The `pykl` module will be built together with KLayout. After KLayout installation, the `pykl` module resides inside the installation tree. To use it, either copy the `pykl` folder to your Python installation or set `PYTHONPATH` to the location of the `pykl` folder.
The `klayout` module will be built together with KLayout. After KLayout installation, the `klayout` module resides inside the installation tree. To use it, either copy the `klayout` folder to your Python installation or set `PYTHONPATH` to the location of the `klayout` folder.
## Using the module
Use the new modules this way:
```
import pykl.tl as tl
import klayout.tl as tl
timer = pykl.tl.Timer()
timer = klayout.tl.Timer()
```
```
import pykl.db as db
import klayout.db as db
# instantiate a KLayout object
box = db.DBox(0, 0, 100, 200)
@ -25,11 +25,11 @@ box = db.DBox(0, 0, 100, 200)
Since `lay` has dependencies on Qt modules, you need to use the following call for this module:
```
import pykl.QtCore
import pykl.QtGui
import klayout.QtCore
import klayout.QtGui
# On Qt5 only:
import pykl.QtWidgets
import pykl.lay
import klayout.QtWidgets
import klayout.lay
...
```
@ -37,26 +37,26 @@ import pykl.lay
To get an index of the classes present in the modules, use:
```
import pykl.tl as tl
import pykl.db as db
import pykl.QtCore
import pykl.QtGui
import klayout.tl as tl
import klayout.db as db
import klayout.QtCore
import klayout.QtGui
# On Qt5 only:
import pykl.QtWidgets
import pykl.lay
import klayout.QtWidgets
import klayout.lay
print "\n".join(pykl.tl.__all__)
print "\n".join(pykl.db.__all__)
print "\n".join(pykl.lay.__all__)
print "\n".join(klayout.tl.__all__)
print "\n".join(klayout.db.__all__)
print "\n".join(klayout.lay.__all__)
```
The Qt binding classes are available to. Essentially this provides an alternative to PyQt:
```
from pykl.QtCore import *
from pykl.QtGui import *
from pykl.QtWidgets import *
from pykl.lay import *
from klayout.QtCore import *
from klayout.QtGui import *
from klayout.QtWidgets import *
from klayout.lay import *
app = QApplication([ "my_app" ])