import tkinter def my_window(w, h): ws = root1.winfo_screenwidth(); hs = root1.winfo_screenheight(); x = (ws/2) - (w/2); y = (hs/2) - (h/2); root1.geometry('%dx%d+%d+%d'%(w, h, x, y)); root1 = tkinter.Tk(className='python windows app') my_window(640, 480); root1.mainloop();
无废话,撸起袖子就是,干!