pil / _imagingtk.c

 * 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 "compat.h"

#include "Imaging.h"

#include "tk.h"

/* must link with Tk/tkImaging.c */
extern void TkImaging_Init(Tcl_Interp* interp);

/* copied from _tkinter.c (this isn't as bad as it may seem: for new
   versions, we use _tkinter's interpaddr hook instead, and all older
   versions use this structure layout) */

typedef struct {
    Tcl_Interp* interp;
} TkappObject;

static PyObject* 
_tkinit(PyObject* self, PyObject* args)
    Tcl_Interp* interp;

    long arg;
    int is_interp;
    if (!PyArg_ParseTuple(args, "li", &arg, &is_interp))
        return NULL;

    if (is_interp)
        interp = (Tcl_Interp*) arg;
    else {
        TkappObject* app;
	/* Do it the hard way.  This will break if the TkappObject
	   layout changes */
        app = (TkappObject*) arg;
        interp = app->interp;

    /* This will bomb if interp is invalid... */

    return Py_None;

static PyMethodDef functions[] = {
    /* Tkinter interface stuff */
    {"tkinit", (PyCFunction)_tkinit, METH_VARARGS},
    {NULL, NULL} /* sentinel */

    Py_InitModule("_imagingtk", functions);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.