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 | |
ae4735db | 18 | (pyfloat_asdouble (pytuple_getitem (triplet,0)))) ^ |
34e49164 C |
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 | ||
ae4735db C |
26 | let x = pywrap_closure |
27 | (fun x -> print_string (pystring_asstring (pytuple_getitem (x,0))) ; | |
34e49164 C |
28 | pynone ()) |
29 | ||
ae4735db | 30 | let _ = pyeval_callobject |
34e49164 | 31 | (x,pytuple_fromsingle (pystring_fromstring "hi there")) |