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 5 Years Ago
by vegaseat: changed code frame
I am using following codes on EVERY textbox.
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
char ch = e.KeyChar;
if (ch == (char)Keys.Back)
e.Handled = ...
This is a fingerprint verification application. When verifying,it loops through the table. if the current fingerprint template is the first one on the table row it verifies it correctly. But ...
Why doesn't the code (2) below produce the same output as the code (1)? Let's say you entered "4" as input:
cout << "enter integer: ";