[Tkinter-discuss] Control position of Tkinter common dialogs?
matt.keenan at oracle.com
Thu Oct 28 11:16:20 CEST 2010
Thanks John, that works a treat...
On 10/27/10 10:26 PM, John McMonagle wrote:
> On 27/10/10 22:27, Matt Keenan wrote:
>> Nice idea, but unfortunately don't work... tkinter appears to be smart
>> enough to ensure you cannot place a dialog outside the bounds of the
>> root display size.
>> Using negative values, positions dialog initially at 0,0.
>> Using massive positive values, positions dialog bottom right of screen.
>> Still looking for a nice solution :-)
>> On 10/27/10 12:07 PM, python at bdurham.com wrote:
>>> Hi Matt,
>>>> I have a similar issue, however not for common dialogs but for a custom
>>> toplevel transient dialogs. As you create your dialog it's dimensions
>>> are not known until all idletasks have completed for child widgets being
>>> added to the dialog.
>>> Disclaimer: I'm new to Tkinter development so take this untested idea
>>> with a grain of salt ...
>>> Have you tried positioning your toplevel window off screen (negative
>>> coordinates) so that it can be fully rendered (and you can capture its
>>> dimensions after all layout calculations have completed), then center
>>> your window afterwards?
>>> If you come up with a working solution, I would love to hear about it.
>>> I'll do the same from my end.
> You need to use the winfo_reqwidth() and winfo_reqheight() methods to
> determine the windows "requested" width and height.
More information about the Tkinter-discuss