views:

291

answers:

1

I've been working through the Tkinter chapters in Programming Python and encountered a problem where the foreground and background colours of a button will not change. I am working on a Mac OS X 10.6 system with Python 2.6.1. The colours of a label will change, but not the colours of a button. For example:

from Tkinter import *

Label(None, text='label', fg='green', bg='black').pack()
Button(None, text='button', fg='green', bg='black').pack()

mainloop()

On my Mac system the colours of the label change, but the colours of the button do not. On a Windows system with Python 2.6.1 the colours of both the label and button change.

Anyone know what is going wrong?

EDIT:

I've checked Interface Builder and it appears that there is no option to change the foreground or background colour of a button in that tool. There is the ability to edit the foreground and background colours of a label.

The Mac OS X rendering system (Quartz?) may just not support (easily) changing the fg and bg of a button.

+1  A: 

I think the answer is that the buttons on the mac simply don't support changing the background and foreground colors. As you've seen, this isn't unique to Tk.

Bryan Oakley
Yep, thanks. Easy accept for you :). Until a better answer comes along.
Anthony Cramp