tkFileDialog.askdirectory

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Abel

    tkFileDialog.askdirectory

    Hello

    i have a Linux Mandrake Distribution with Python 2.3 and Tcl/Tk 8.4.

    Python 2.2 and Tcl/Tk 8.3.3 returns an String if i made this:

    x = tkFileDialog.as kdirectory(init ialdir="was auch immer", title="xxx")
    print type(x)

    <type 'str'>

    With the combination Python 2.3 and Tcl/Tk 8.4 it returns
    <type '_tkinter.Tcl_O bj'>

    I have asked an other user (he used Windows 2000 Python 2.3.2
    Tcl/Tk 8.4) and it returns an string.

    Is the Python version the reason or what goes wrong,
    or is it a new feature?

    Mike
  • Mike Abel

    #2
    Re: tkFileDialog.as kdirectory

    Mike Abel <Ax10@gmx.de> wrote:[color=blue]
    > Hello[/color]
    [color=blue]
    > i have a Linux Mandrake Distribution with Python 2.3 and Tcl/Tk 8.4.[/color]
    [color=blue]
    > Python 2.2 and Tcl/Tk 8.3.3 returns an String if i made this:[/color]
    [color=blue]
    > x = tkFileDialog.as kdirectory(init ialdir="was auch immer", title="xxx")
    > print type(x)[/color]
    [color=blue]
    > <type 'str'>[/color]
    [color=blue]
    > With the combination Python 2.3 and Tcl/Tk 8.4 it returns
    > <type '_tkinter.Tcl_O bj'>[/color]
    [color=blue]
    > I have asked an other user (he used Windows 2000 Python 2.3.2
    > Tcl/Tk 8.4) and it returns an string.[/color]

    The reason for this is possibly this:

    "Calling Tcl methods through _tkinter no longer returns only strings.
    Instead, if Tcl returns other objects those objects are converted to
    their Python equivalent, if one exists, or wrapped with a
    _tkinter.Tcl_Ob j object if no Python equivalent exists. This behavior
    can be controlled through the wantobjects() method of tkapp objects.
    When using _tkinter through the Tkinter module (as most Tkinter
    applications will), this feature is always activated. It should not
    cause compatibility problems, since Tkinter would always convert string
    results to Python types where possible.

    If any incompatibiliti es are found, the old behavior can be restored by
    setting the wantobjects variable in the Tkinter module to false before
    creating the first tkapp object.


    import Tkinter
    Tkinter.wantobj ects = 0

    Any breakage caused by this change should be reported as a bug."


    Thanks to Klaus

    Comment

    Working...