473,386 Members | 1,793 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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.askdirectory(initialdir="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_Obj'>

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
Jul 18 '05 #1
1 4552
Mike Abel <Ax**@gmx.de> wrote:
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.askdirectory(initialdir="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_Obj'> I have asked an other user (he used Windows 2000 Python 2.3.2
Tcl/Tk 8.4) and it returns an string.


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_Obj 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 incompatibilities 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.wantobjects = 0

Any breakage caused by this change should be reported as a bug."
Thanks to Klaus
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tim Williams | last post by:
I just installed Python 2.3 on my Redhat system. When I tried to run one of my programs that use tkFileDialog.askopenfilename(), I got an error because it returns a tuple instead of a null string...
3
by: Tim Williams | last post by:
Hi. I'm using Python 2.3 and trying to use tkFileDialog to get a list of files. I get a message about the '-multiple' option is not a valid option in the call to Open. Python 2.3 (#1, Aug ...
2
by: Tim Williams | last post by:
I'm using Python 2.3.2 and tkFileDialog in a program I have. I'm trying to use this on Linux (RH 8.0) and Windows 2000. When I first upgraded from v2.2 to v2.3. I noticed that...
2
by: Ringwraith | last post by:
Hello! I have the following problem. I use the tkFileDialog.askdirectory dialog to allow users of my application to pick some subfolder from 'C:/my_app' directory. I use initialdir='C:/my_app'...
2
by: Read Roberts | last post by:
I have the current Windows binary install of Python 2.3.4 on my Windows XP system. I am pained to discover that tkFileDialog.askdirectory() returns a mangled path when a directory is selected...
3
by: jaime.suarez | last post by:
I am creating a very simple GUI with one Entry widget and one Button. The purpose of the Button widget is to Browse for a file using tkFileDialog.askopenfilename(). I bind the button to a...
9
by: cdroulers | last post by:
Hello, I am working on a school project that requires me to get the path of a filename for future treatment. I've tried getting a file with tkFileDialog.askopenfile. ...
1
by: Gheorghe Postelnicu | last post by:
In our example, try replacing the last line with print file.name ---------- Forwarded message ---------- From: cdroulers@hotmail.com To: python-list@python.org Date: 8 Nov 2006 11:01:08...
0
by: Matthias Huening | last post by:
Hi, I have problems using tkFileDialog under Linux (Ubuntu 8.04 in my case, but other Linuxes seem to show the same behaviour). The following works fine: import tkFileDialog f =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.