[newbie] problem with geometry setting in Tkinter

Peter Otten __peter__ at web.de
Mon Feb 8 07:26:31 EST 2016


jenswaelkens at gmail.com wrote:

> I'm trying to set the geometry of my top window, but the size is
> unaffected.
> This is the code:
> 
> #!/usr/bin/env python
> import Tkinter
> top=Tkinter.Tk()
> top.geometry=('900x460')

That's an assignment, but geometry() is a method that you have to invoke:

top.geometry('900x460')

> top.update_idletasks()
> print (top.winfo_width())
> print (top.winfo_height())
> print (top.winfo_geometry())
> top.mainloop()
> 
> and this is the result when running the code:
> 200
> 200
> 200x200+1+584
> 
> 
> Can anyone here tell me what I am doing wrong and how to change it?
> Thanks
> 
> Jens





More information about the Python-list mailing list