How can I best center a Tkinter window on my display screen?
Not knowing Tkinter that well, here is a somewhat simple minded approach:
from Tkinter import *
def center_window(w=300, h=200):
# get screen width and height
ws = root.winfo_screenwidth()
hs = root.winfo_screenheight()
# calculate position x, y
x = (ws/2) - (w/2)
y = (hs/2) - (h/2)
root.geometry('%dx%d+%d+%d' % (w, h, x, y))
root = Tk()
Edited 4 Years Ago
by vegaseat: changed code frame
Hi all you php buffs.
Out of simple curiosity I thought I would take a look at php.
I've been programing since I joined IBM as a trainee developer in ...
I´m not a professional in vb.net, but i try to make a tool for my colleague and me. I got a XMLTreeView on my form and i load a ...
Write a program, which will imitate an ATM machine. The program will ask for a password. Assume that only password 123456 is accepted. If the password is correct, display the ...