Tkinnter questions

pu pu at myRealBox.com
Sat Nov 2 18:13:58 EST 2002


Hello,
I have two questions regarding the code that follows, for which I cannot
find an answer in the TK doc:

1- the window always appears in the upper left corner of my screen - how can
I make it appear at the center of the screen ?
2- no button gets the focus, but I would like the "backup" button to have it
when the window show up.

-PU

----------------------------------------------------------------------------
---------------------
import sys
import Tkinter
from puBackupIni import *

if __name__ == "__main__":

    def buttonCancel():
        tkRoot.quit()
    def buttonBackup():
        tkRoot.quit()

    tkRoot = Tkinter.Tk()
    tkRoot.title("puBackup")
    tkRow=0
    Tkinter.Label(tkRoot,text="Backing up "+backupId+" to
"+backupTo).grid(row=tkRow,column=0,columnspan=2,sticky="w")
    tkRow+=1

Tkinter.Button(tkRoot,text="Backup",command=buttonBackup,bd=4).grid(row=tkRo
w,column=0)

Tkinter.Button(tkRoot,text="Cancel",command=buttonCancel).grid(row=tkRow,col
umn=1)

    tkRoot.mainloop()
    print "end of main"






More information about the Python-list mailing list