forked from python-pillow/Pillow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_imagingtk.c
66 lines (56 loc) · 1.34 KB
/
_imagingtk.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* The Python Imaging Library.
*
* tkinter hooks
*
* history:
* 99-07-26 fl created
* 99-08-15 fl moved to its own support module
*
* Copyright (c) Secret Labs AB 1999.
*
* See the README file for information on usage and redistribution.
*/
#include "Python.h"
#include "libImaging/Imaging.h"
#include "Tk/_tkmini.h"
/* must link with Tk/tkImaging.c */
extern void
TkImaging_Init(Tcl_Interp *interp);
extern int
load_tkinter_funcs(void);
static PyObject *
_tkinit(PyObject *self, PyObject *args) {
Tcl_Interp *interp;
PyObject *arg;
if (!PyArg_ParseTuple(args, "O", &arg)) {
return NULL;
}
interp = (Tcl_Interp *)PyLong_AsVoidPtr(arg);
/* This will bomb if interp is invalid... */
TkImaging_Init(interp);
Py_INCREF(Py_None);
return Py_None;
}
static PyMethodDef functions[] = {
/* Tkinter interface stuff */
{"tkinit", (PyCFunction)_tkinit, 1},
{NULL, NULL} /* sentinel */
};
PyMODINIT_FUNC
PyInit__imagingtk(void) {
static PyModuleDef module_def = {
PyModuleDef_HEAD_INIT,
"_imagingtk", /* m_name */
NULL, /* m_doc */
-1, /* m_size */
functions, /* m_methods */
};
PyObject *m;
m = PyModule_Create(&module_def);
if (load_tkinter_funcs() != 0) {
Py_DECREF(m);
return NULL;
}
return m;
}