Skip to content

Commit fe4a27e

Browse files
authored
Create tutorial01.md
1 parent 99a703d commit fe4a27e

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

docs/pages/tutorial01.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Tutorial
2+
3+
This tutorial is a gentle introduction to using PythonBridge. It is written for Pharo, however, it works equally well for VisualWorks.
4+
5+
The tutorial assumes that you have PythonBridge correctly installed in your Smalltalk environment and have Python and Pipenv installed. If this is not the case, then you should follow the instruction given in https://objectprofile.github.io/PythonBridge/
6+
7+
## How do I know if Python and Pipenv are correctly installed?
8+
If you have PythonBridge installed, and you do not know if you Python environment is correctly setup, the easy way to check this is evaluate the following expression:
9+
10+
```Smalltalk
11+
PBApplication do: [
12+
PBCF << (P3GBinaryOperator new left: 1; right: 2; operator: $+; yourself).
13+
PBCF send waitForValue ]
14+
```
15+
16+
If it returns `3`, then your Python setting is properly installed and you can continue the tutorial. If it does not return 3, but raises en error, then you should revise your Python installation. In case you a VisualWorks user, do not forget to manually set the path to `Pipenv.exe` as specified [here](https://objectprofile.github.io/PythonBridge/pages/vw-installation).
17+
18+
## Installing the OpenCV Python module
19+
20+
Before jumping into Smalltalk, we need to make sure that the OpenCV Python library is installed in your Pipenv environment before continuing. You need to open a terminal that points to the `PythonBridge` folder, next to your image. Edit the file called `Pipenv` and add the line `opencv-python = "*"` in the `[packages]` section. You `Pipfile` should be very similar to:
21+
22+
```
23+
[[source]]
24+
name = "pypi"
25+
url = "https://pypi.org/simple"
26+
verify_ssl = true
27+
28+
[dev-packages]
29+
30+
[packages]
31+
flask = "*"
32+
requests = "*"
33+
msgpack = "*"
34+
opencv-python = "*"
35+
36+
[requires]
37+
python_version = "3"
38+
```
39+

0 commit comments

Comments
 (0)