[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] OS X: pygame breaks Tk windows



On OS X (10.4), pygame.init() breaks the keyboard focus for any Tk
windows that are opened subsequently.  Tk windows that are opened
before the pygame.init() are OK only if update_idletasks() is called
before the pygame.init().

Below is a minimal test case.  The following code opens two identical
Tk windows containing text boxes, one before, and one after
pygame.init().  On linux/x11, the text in both windows can be selected
and edited (correct behaviour).  On OS X, the text in the first window
is editable (although, probably irrelevantly, it fails to appear until
clicked).  The text in the second window is **not** selectable or
editable.

Tested with os-x 10.4.1, python 2.4.1, pygame 1.6.2, tk 8.4.9.

---------

from Tkinter import *
import pygame

def make_window(text):
       tk = Tk()
       txtfield = Entry(tk)
       txtfield.insert(0,text)
       txtfield.pack()
       return tk

print 'Making functional Tk window'
tk = make_window("You can select me!")

tk.update_idletasks()

print 'Initialising pygame'
pygame.init()

print 'Making non-functional Tk window'
tk2 = make_window("You can't select me!")

tk.mainloop()