Commit | Line | Data |
---|---|---|
34e49164 C |
1 | (* |
2 | * (C) arty 2002 | |
3 | * This software is covered under the GNU lesser general public license | |
4 | *) | |
5 | open Pycaml ;; | |
6 | ||
7 | let colorsys = pyimport_importmodule "colorsys" | |
8 | let dict = pymodule_getdict colorsys | |
9 | ||
10 | let triplet = pytuple3 (pyfloat_fromdouble 1.0, | |
11 | pyfloat_fromdouble 0.5, | |
12 | pyfloat_fromdouble 0.2) ;; | |
13 | ||
14 | let rgbtoyiq = pydict_getitemstring (dict,"rgb_to_yiq") | |
15 | let triplet = pyeval_callobject (rgbtoyiq,triplet) | |
16 | ||
17 | let _ = print_endline ((string_of_float | |
18 | (pyfloat_asdouble (pytuple_getitem (triplet,0)))) ^ | |
19 | " " ^ | |
20 | (string_of_float | |
21 | (pyfloat_asdouble (pytuple_getitem (triplet,1)))) ^ | |
22 | " " ^ | |
23 | (string_of_float | |
24 | (pyfloat_asdouble (pytuple_getitem (triplet,2))))) ;; | |
25 | ||
26 | let x = pywrap_closure | |
27 | (fun x -> print_string (pystring_asstring (pytuple_getitem (x,0))) ; | |
28 | pynone ()) | |
29 | ||
30 | let _ = pyeval_callobject | |
31 | (x,pytuple_fromsingle (pystring_fromstring "hi there")) |