I tried to define geometry for Tkinter GUI using following script using python Tkinter:
from Tkinter import *
root = Tk()
w=300
h=200
ws = root.winfo_screenwidth()
hs = root.winfo_screenheight()
x = (ws/2) - (w/2)
y = (hs/2) - (h/2)
root.geometry('%dx%d+%d+%d' % (w, h, x, y))
root.mainloop()`
I'm getting following error:
TclError: bad geometry specifier "1920*1200+150+100".
The error looks like you're using '%d*%d+%d+%d' % (w, h, x, y) instead of '%dx%d+%d+%d' % (w, h, x, y).
Are you sure you use the x and not the *?
Use x(character) instead of *
root.geometry("100x100")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With