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