Tkinter doesn't work for MFC applications with Embedded Python?
Volucris
volucris at hotmail.com
Fri Jul 6 01:47:19 EDT 2001
You might want to try 'print sys.exc_info()' instead of 'print "failed"'. It
might help in closing in on the problem.
--
Volucris (a) hotmail.com
"Eu não falo uma única palavra do português."
"Deepak" <deepak9999 at mail.com> wrote in message
news:48365474.0107052029.12d28427 at posting.google.com...
> Hi,
> I tried to go through all the related postings on the newsgroup
> regarding this.
> However, I haven't figured out a way to get Tkinter working in an MFC
> application that uses embedded python interpreter... Here is the
> simple code
> that I am trying in the MFC application
>
> The code in C is simple like this: -
>
> #include <Python.h>
>
> void myFunc (int argc, char **argv)
> {
> Py_Initialize ();
> PySys_SetArgv (argc, argv);
> PyRun_SimpleString ("execfile('myTkinterApp.py')");
> }
>
> The code in Python script (myTkinterApp.py) is like this: -
>
> try:
> import Tkinter
> print 'Tkinter successfully imported'
> try:
> root = Tkinter.Tk ()
> print 'Successful'
> except:
> print 'failed'
> except:
> print 'Could not import Tkinter'
>
>
> The result is that it prints: -
>
> Tkinter successfully imported
> failed
>
> The STDOUT is redirected to print to one of the MFC windows.
> I tried to run this by changing the STDOUT to default (standard)
> STDOUT. However, even that did not help.
>
> Any examples or suggestions will be extremely valuable.
> Deepak
More information about the Python-list
mailing list