-
-
Notifications
You must be signed in to change notification settings - Fork 185
Add "from_existing_window" function to the _sdl2.Window #1837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I've just noticed:
Was recently added since SDL 2.0.22 which may solve this issue a bit more smoothly on very recent versions of SDL. You can use:
To make this possible. I'm guessing it would be something like:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above. It would be good to get a neater version of the fix in for the far future when we eventually are able to drop support for pre-2.0.24 versions of sdl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has developed a merge conflict after recent merges.
89ca8eb
to
695e638
Compare
9e63c75
to
e9366d5
Compare
|
Now import tkinter
import threading
import os
root=tkinter.Tk()
root.geometry("640x480")
btn=tkinter.Button(root,text="HelloWorld\n你好世界")
btn.pack()
cv=tkinter.Canvas(root)
cv.pack()
off=0
def pg_loop(hwnd):
import pygame
from pygame._sdl2 import video
os.environ['SDL_WINDOWID']=str(hwnd)
pygame.display.init()
sf=pygame.display.set_mode()
pos=(20,20)
while not off:
sf.fill((0,0,0))
pygame.draw.rect(sf,(255,0,0),(*pos,10,10))
pygame.display.update()
for event in pygame.event.get():
if event.type==1024:#MOUSEMOTION
pos=event.pos
else:
print(event)
if __name__ == "__main__":
hwnd=cv.winfo_id() # get the handle of the canvas widget
p=threading.Thread(target=pg_loop,args=(hwnd,))
p.start()
root.mainloop()
off=1
|
Add "from_existing_window" function to the _sdl2.Window
This PR is cloned from pygame/pygame#3685.
2023-02-06T21:59:19Z yunline wrote:
2023-01-27T19:18:18Z MyreMylar wrote:
2023-01-29T02:43:50Z yunline wrote:
2023-01-29T17:55:31Z MyreMylar wrote:
2023-01-30T08:50:24Z yunline wrote:
2023-01-30T08:46:03Z yunline wrote:
2023-01-30T19:39:51Z MyreMylar wrote:
2023-02-02T11:15:04Z yunline wrote:
2023-02-02T12:31:43Z yunline wrote:
2023-02-04T01:25:29Z chimosky wrote:
2023-02-06T21:59:19Z Mega-JC wrote: