473,698 Members | 2,643 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

tkFileDialog.as kdirectory

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
Jul 18 '05 #1
1 4567
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.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.


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
Jul 18 '05 #2

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

Similar topics

0
2853
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 when I select Cancel. Python 2.2: Python 2.2.2 (#3, Jan 21 2003, 08:39:06) on linux2 Type "help", "copyright", "credits" or "license" for more information.
3
3777
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 4 2003, 10:43:11) on linux2 Type "help", "copyright", "credits" or "license" for more information.
2
2511
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 tkFileDialog.askopenfilename() returns a tuple on Cancel instead of ''. I found that the Windows version still returns a string (''). Now I'm finding out that tkFileDialog.Directory().show() does this too. >>> d1=tkFileDialog.Directory().show() >>>...
2
2922
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' option to set 'C:/my_app' as initial directory. But I want my initial directory to be also a root directory, so the user cannot pick any directory outside 'C:/my_app' folder. I have no idea how to do it using standard tkFileDialog.askdirectory....
2
4281
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 which has non-ascii Unicode path, as in Kanji characters, i.e. the usull "????" in place of the original UTF-8 code points. . After some time spent Google'ing. I don't find a discussion of this. Is there some option or configuration change I...
3
1646
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 handler which spawns a tkFileDialog. This works but the button __stays depressed__ after the handler returns! Any ideas why? class MyApp: def __init__(self, parent):
9
2140
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. ******************************************** import tkFileDialog file = tkFileDialog.askopenfile() print file
1
3264
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 -0800 Subject: Problem getting a file pathname with tkFileDialog Hello,
0
1182
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 = tkFileDialog.askopenfilename()
0
9170
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8904
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2341
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.