On 7/20/2014 5:14 PM, Rick Johnson wrote:

Idle's Open file dialog is not modal.
More than one can be open at one time.
The all open as the same place.
They can all be hidden by other windows, including the parent, especially if the parent is full screen.

These might or might not be design bugs, I do not know that any are implementation bugs. They are definitely minor issues compared to some other Idle issues.

Modal dialogs *MUST* be limited to a "one dialog at a time"

These are not modal.

If for some reason IDLE is not using the tkFileDialogs,

Easily investigated from within Idle itself, using Find in Files Alt+F3 to search for tkFileDialog in idlelib, which became tkinter.filedialog in 3.x.

Searching 'tkFileDialog' in lib/idlelib/*.py ...
lib/idlelib\IOBinding.py: 7: import tkinter.filedialog as tkFileDialog
lib/idlelib\IOBinding.py: 496: self.opendialog = tkFileDialog.Open(master=self.text, lib/idlelib\IOBinding.py: 516: self.savedialog = tkFileDialog.SaveAs( lib/idlelib\configHelpSourceEdit.py: 8: import tkinter.filedialog as tkFileDialog lib/idlelib\configHelpSourceEdit.py: 94: opendialog = tkFileDialog.Open(parent=self, filetypes=filetypes)
Hits found: 5
(Hint: right-click to open locations.)

As the output says, a right click will take one to the usage sites.


# The following code proves that Tkinter filedialogs are
# behaving in expected manners (properly placed as children
# of the windows which "own" them, and following normal
# focus patterns of "child windows" -- therfore, the problem
# *MUST* be an IDLE problem.
#
# Tested on Python 2.7.8
#
import Tkinter as tk
from tkFileDialog import askopenfilename, asksaveasfilename

class App(tk.Tk):
     def __init__(self):
         tk.Tk.__init__(self)
         self._createMenus()

     def _createMenus(self):
         menubar = tk.Menu(self)
         self.config(menu=menubar)
         filemenu = tk.Menu(menubar)
         menubar.add_cascade(label='File', menu=filemenu)
         filemenu.add_command(label='Open', command=self.requestOpenDialog)
         filemenu.add_command(label='Save As', command=self.requestSaveAsDialog)

     def _requestFileDialog(self, func, **kw):
         path = func(**kw)
         return path

     def requestOpenDialog(self, **kw):
         return self._requestFileDialog(askopenfilename, **kw)

     def requestSaveAsDialog(self, **kw):
         return self._requestFileDialog(asksaveasfilename, **kw)

if __name__ == '__main__':
     app = App()
     app.mainloop()

I will save this to look at some time.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to