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 6 Years Ago
by vegaseat: changed code frame
Is there any simple way or online website that can convert The numerical string like"123-322-14365" to regular expression?
I am trying to process the data in a single file . i have to read the file and create a hash structure,get the value of fruitname append it to ...
This is a program that ask input from the user about the characteristics of a gemstone then prints to the screen. Things like color, price and name. I have written ...