Dear all,

Currently I am facing the problem on getting the resources for getting Tkinter and pygame to work together. Sadly, I do not have any leads til now(Which worries me alot!! :( ) so I hope the people here can point me to the correct direction. So basically I want to do something like this...

[img]http://i41.tinypic.com/34h9cpl.jpg[/img]

the latest research development is these two links..

I think the closest is this...
http://www.daniweb.com/forums/thread104130.html#
and
http://translate.google.com/translate?j ... auto&tl=en :?:

but I am not very sure on how to make it work...

Really appreciate it if someone can point me to the correct direction..:|

from tkinter import *
import pygame
import random
import os
root = Tk()
embed = Frame(root, width=640, height=480)
embed.grid(row=0,column=2)
root.update()
os.environ['SDL_WINDOWID'] = str(embed.winfo_id())
os.environ['SDL_VIDEODRIVER'] = 'windib'
pygame.display.init()
screen = pygame.display.set_mode((640,480))
pygame.display.flip()
while True:
    #your code here
    screen.fill((random.randint(0,255),random.randint(0,255),random.randint(0,255)))
    pygame.display.flip()
    root.update()

Try this. I've used it before, and it works quite well.

The two different eventloops don't work very gracefully together. There is a lot of flickering. Threading might improve performance?

The only thing that works reasonably well is the pygame.mixer and Tkinter to play sounds in a Tkinter application.

Edited 2 Years Ago by vegaseat

This question has already been answered. Start a new discussion instead.