[Tkinter-discuss] Control position of Tkinter common dialogs?

python at bdurham.com python at bdurham.com
Mon Oct 25 22:45:08 CEST 2010


Python 2.7 under Windows: How can we control the position of
Tkinter's common dialogs?

Here's what we've discovered:

  * Certain common dialogs always open up relative to their
    parent window

  * Certain common dialogs always open up centered on the user's
    desktop

  * All common dialogs appear to ignore the optional parent=
    parameter

Questions:

  * How can we force a dialog to open up relative to its parent
    window?

  * How can we force a dialog to open up centered on the user's
    desktop?

Background:

import tkColorChooser as colorchooser
import tkFileDialog as filedialog
import tkMessageBox as messagebox

# always open up relative to parent windows
fileOpen   = filedialog.askopenfilename()
fileOpens  = filedialog.askopenfilenames()
fileSaveAs = filedialog.asksaveasfilename()
color      = colorchooser.askcolor()

# always open up centered on desktop
folderOpen = filedialog.askdirectory()
messagebox.askquestion()

Malcolm


More information about the Tkinter-discuss mailing list