Screen placement based on screen resolution

Fredrik Lundh fredrik at pythonware.com
Sat Apr 8 02:18:20 EDT 2006


Lonnie Princehouse wrote:

> Tkinter takes strings as its arguments; it's TCL's legacy.

geometry strings are an X windows thing...

> You can use string formatting for this:
>
> x = width/2-40
> y = height/2-30
>
> root.geometry('%ldx%ld+%ld+%ld' % (width, height, x, y))

note that "+%ld" (why bother with the l, btw? Python's not C) will
misbehave if you pass in a negative offset.  better use "%+d".

</F>






More information about the Python-list mailing list