we have a simple game engine developed in c++, we’re trying to expose some API using PyBind11 to Python, and then embed the engine window into an other window, which will act like a dash board that has the adding functionality, is this possible tho?
I did some google search on this, found that I might need to use SDL_CreateWindowFrom(), but I don’t have any graphics background, so really need some help!
Here is the reference I read How can I embed an SDL2 window in my Tkinter GUI application?
Here is what I have tried, however CreateWindowFrom is giving me SIGSEGV
import tkinter as tk
from tkinter import *
from sdl2 import *
import ctypes
print('0')
root = tk.Tk();
root.geometry('1500x700')
embed = tk.Frame(root, width = 800, height = 400)
embed.pack(side=LEFT)
SDL_Init(SDL_INIT_VIDEO)
print('1')
window = SDL_CreateWindowFrom(str(embed.winfo_id()))
print('2')
ren = SDL_CreateRenderer(window, -1, 0)
print('3')
SDL_SetRenderDrawColor(ren, ctypes.c_utype(255), ctypes.c_utype(20),
ctypes.c_utype(147), ctypes.c_utype(255))
print('4')
SDL_RenderClear(ren)
print('5')
while True:
SDL_RenderPresent(ren)
root.update()
print('loop')