[Tutor] Question about pygame/tkinter interaction
lie.1296 at gmail.com
Tue Jan 20 12:48:19 CET 2009
On Mon, 19 Jan 2009 15:46:27 -0800, Steve Willoughby wrote:
> On Mon, Jan 19, 2009 at 05:30:01PM -0500, Kent Johnson wrote:
>> My guess is that pygame and Tkinter are both going to want to control
>> the event loop. Googling 'pygame tkinter' gives both hints that it
>> might be possible and hints of trouble...
> Yeah, I was thinking that, but since what I saw up until the point I
> asked the list was that for pygame you seem to write your own event
> loop, like
> while True:
> whereas Tkinter wants you to just hand it control and let your program
> flow disappear into that black box entirely, until it pokes callbacks at
> you, I thought... "Well, maybe..."
I guess it shouldn't be too difficult if what you're intending is to have
one window controlled by Tkinter and the other by pygame, it's just a
matter of having Tkinter calling pygame's event handler once in a while
(so instead of
insert an event that makes Tkinter calls handle_pygame_event() every once
in a while.
What I don't know is whether it is possible to "embed" a pygame-
controlled frame into Tkinter-controlled window.
More information about the Tutor