PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"!

Rick Johnson rantingrickjohnson at gmail.com
Sun Jul 20 23:14:09 CEST 2014


============================================================
 BUG 1: FileDialog Duplicity:
============================================================

If you open the IDLE application (either utilizing the
"shell window" or "editor window") and then go to the "File"
menu and choose the "Open" command you will see a file
dialog appear, okay, nothing wrong with that.

HOWEVER, if you go to the "File" menu *AGAIN* choose the
"Open" command, you will see *ANOTHER* file dialog open.

    Note that on windows (at least), the new file dialogs are
    stacked *perfectly* on top of old filedialogs, so you will
    need to move the top dialog before you can see any
    hiding below.

And not only can you open more than one dialog ,there seems
to be no limit on the number of dialogs you can open!

Modal dialogs *MUST* be limited to a "one dialog at a time"
policy. And even *IF* the designers of Tkinter were too
naieve to relize this, the designers of IDLE should have
been intelligent enough to ensure this cannot happen,
because, opening more than one filedialog is about has
useful as buying shoes in sets of greater than two.

    Two feet -> two shoes.

    One document -> one dialog

    or rather,

    One dialog per "active" document!

And since IDLE is not a "tabbed editor", only *1* document
is going to be displayed at a time. The troubling issue is,
Tkinter filedialogs are working fine (see my code at the end
of this message which proves my statement!), whereas the
IDLE dialogs which utilize Tkinter code are not!

    ============================================================
     POSSIBLE FIX FOR "BUG 1":
    ============================================================

    If for some reason IDLE is not using the tkFileDialogs, a
    simple "request contract" can solve the issue by setting a
    "counter variable" like "activeFileDialogs = 0", then
    incrementing the counter by 1 each time a filedialog is
    displayed, and then decrementing the value by one each time
    a filedialog is closed. Furturemore, each time a filedialog
    is "requested", the logic will deny the request *IF* the
    value of "activeFileDialogs" is greater than one. However,
    this all seems rediculous since Tkinter filedialogs are
    working as expected! (see code at end of this message)

============================================================
 BUG 2: FileDialog "Hide and go seek":
============================================================

When you have a filedialog displayed *AND* the "parent
window" from which you spawned the filedialog is in "full
screen" mode, if you (or your OS) decides to "unfocus" the
"parent window" window, when you return you will *NOT* see
the open dialog, because the filedialog will be hidden
*BEHIND* the full screen "parent window".

Again, this only happens in IDLE, but in my example code at
the end of this message you will find that the dialog
behaves as expected.

============================================================
 BUG 3: FileDialog not using "native" dialogs anymore.
============================================================

Currently, when opening a filedialog in IDLE, i don't get
the "shortcut pane" that is visible in my Windows Explorer
application, *HOWEVER*, before i updated to version 2.7.8 i
swear it was there!

    WHAT THE HECK HAPPNED?

============================================================
 REFERENCES:
============================================================

############################################################
# BEGIN CODE
############################################################
# 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()
#
############################################################
# END CODE
############################################################







More information about the Python-list mailing list