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

YMohan yogendra_mohan at oxyent-medical.com
Sat Mar 28 10:28:47 CET 2009

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 - 

from Tkinter import * 

def closeApp():
def replySUBJECTNAME(root):
    print 'Ok clicked'
def SUBJECTNAME(root):
    root.geometry('220x100+%d+%d' % ((w-220)/2, (h-100)/2))
    root.title("SUBJECT NAME")
    btn=Button(root, name="okbutton", text="OK", command=(lambda:
    btn.configure(bg = "blue", fg = "red")
    btn.grid(row="0", column="0", sticky=NW)
    btn.bind('<Return>', lambda e:replySUBJECTNAME(root)) 
    Button(root, text="Cancel", command=(lambda:  closeApp())).grid(row="0",
column="0", sticky=N)
    entry = Entry(root, width = "30", name="entry").grid(row="1",
    child = root.nametowidget("entry")
    child.insert(0, "Subject Name")

root = Tk()

Please let me know what I am doing wrong in above code or if any other

Thanks in advance.

Yogendra Mohan http://www.nabble.com/file/p22755049/MAC.png 
View this message in context: http://www.nabble.com/Facing-issue-to-show-the-default-button-Selected-on-MAC-OS----urgent-tp22755049p22755049.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.

More information about the Tkinter-discuss mailing list