Pillow

Форк
0
/
_imagingtk.c 
71 строка · 1.4 Кб
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 */
21
extern void
22
TkImaging_Init(Tcl_Interp *interp);
23
extern int
24
load_tkinter_funcs(void);
25

26
static PyObject *
27
_tkinit(PyObject *self, PyObject *args) {
28
    Tcl_Interp *interp;
29

30
    PyObject *arg;
31
    if (!PyArg_ParseTuple(args, "O", &arg)) {
32
        return NULL;
33
    }
34

35
    interp = (Tcl_Interp *)PyLong_AsVoidPtr(arg);
36

37
    /* This will bomb if interp is invalid... */
38
    TkImaging_Init(interp);
39

40
    Py_INCREF(Py_None);
41
    return Py_None;
42
}
43

44
static PyMethodDef functions[] = {
45
    /* Tkinter interface stuff */
46
    {"tkinit", (PyCFunction)_tkinit, 1},
47
    {NULL, NULL} /* sentinel */
48
};
49

50
PyMODINIT_FUNC
51
PyInit__imagingtk(void) {
52
    static PyModuleDef module_def = {
53
        PyModuleDef_HEAD_INIT,
54
        "_imagingtk", /* m_name */
55
        NULL,         /* m_doc */
56
        -1,           /* m_size */
57
        functions,    /* m_methods */
58
    };
59
    PyObject *m;
60
    m = PyModule_Create(&module_def);
61
    if (load_tkinter_funcs() != 0) {
62
        Py_DECREF(m);
63
        return NULL;
64
    }
65

66
#ifdef Py_GIL_DISABLED
67
    PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
68
#endif
69

70
    return m;
71
}
72

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.