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

root = Tk()
SUBJECTNAME(root)
root.mainloop()

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

Thanks in advance.

Yogendra Mohan http://www.nabble.com/file/p22755049/MAC.png 
http://www.nabble.com/file/p22755049/window.jpg 
-- 
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.

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to