[Tutor] Is there an easy way to center the root window (Tkinter) within the display?

boB Stepp robertvstepp at gmail.com
Wed Nov 26 18:44:29 CET 2014


On Wed, Nov 26, 2014 at 11:23 AM, Alan Gauld <alan.gauld at btinternet.com> wrote:
> On 26/11/14 16:46, boB Stepp wrote:
>
>> I can accomplish this by getting the screen height and width and
>> calculating pixel coordinates. But so far I have not found something
>> equivalent to anchor = 'CENTER' that can be applied to the root
>> window. Does such an easy attribute, method, or whatever exist in
>> Tkinter?
>
>
> I'm not aware of one.
> But forcing a window to be centre of the display is usually
> a bad idea - and very annoyying to the user, especially if they have
> explicitly set their preferences for where new windows should appear.

Thanks for bringing this to my attention. I do not believe it applies
to my current situation, but I could see that I need to keep it in
mind for most other things I might do.

In the current scenario, users of our planning system will initiate a
planning system script (proprietary language) that will call my python
program. The user cannot proceed further until my program completes,
which requires user interaction. So I do want it to be front and
center.

I will just have to do this the hard way then, which actually isn't
too hard ~(:>))


-- 
boB


More information about the Tutor mailing list