[Tkinter-discuss] Facing issue to show the default button Selected on MAC OS - urgent

Kevin Walzer kw at codebykevin.com
Mon Mar 30 16:01:52 CEST 2009

YMohan wrote:
> Hi All,
> I am using MAC OS 10.5.1 and Python 2.5.1. I want to show the defalut
> selected button in Tk window. I have two buttons OK and CANCEL. I want to
> show the by default OK Button selected but I am not able to do the same on
> MAC environment. The same code works in Windows. I have tried to set the
> background color of button but no success. Please refer the attached images.
> First image is MAC window and second one is Window's window.
> Can anybody tell me what I am doing wrong in below code or how to set the
> default selected button? I have written the following code - 

On the Mac, Tk buttons ignore the -bg and -fg flags.

The way to specify the default button would be something like this:

btn.configure(bg = "blue", fg = "red", default=ACTIVE)

That shows the Mac Tk button with focus/selected state. This should work 
on Windows, as well--there's no need to specify -fg and -bg colors to 
indicate default status.

Kevin Walzer
Code by Kevin

More information about the Tkinter-discuss mailing list