I Embedding PyPy in C++. Everything works fine. But when I import the tkinter module, I get an error. I am compiling the code in visual studio 2019. Sample code:

#include <PyPy.h>
#include <stdio.h>

int main()
{
  int res;

  rpython_startup_code();
  pypy_setup_home("C:\\pypy37\\",1);
  res = pypy_execute_source("import math ; print (math.pow(2,3)) ");
  pypy_init_threads();

  return res;
}

PS C:\Users\.....\x64\Debug> ./pypyrun.exe
8.0

The above code works without errors. But, the code below fails. The imported tkinter module is generating an error.

#include <PyPy.h>
#include <stdio.h>

int main()
{
  int res;

  rpython_startup_code();
  pypy_setup_home("C:\\pypy37\\",1);
  res = pypy_execute_source("from tkinter import *;window = Tk();window.mainloop() ");
  pypy_init_threads();

  return res;
}

The error output is as follows;

PS C:\Users\.....\x64\Debug> ./pypyrun.exe
debug: OperationError:
debug:  operror-type: IndexError
debug:  operror-value: list index out of range