msg375601 - (view) |
Author: Prudent (Prudent) * |
Date: 2020-08-18 08:50 |
I am writing codes for opening file dialog to select a file by clicking a button. The function I used was "askopenfilename()" in tkinter.filedialog module. However, a warning displayed when I ran the code. And, the file filter option was also disabled after one click. The displayed warning was below.
|
msg375604 - (view) |
Author: E. Paine (epaine) * |
Date: 2020-08-18 09:59 |
To help us to reproduce the issue, please give your Python version, Tcl/Tk patchlevel (`tkinter.test.support.get_tk_patchlevel()`), MacOS version and a small demonstration script (along with exact keystrokes/clicks if necessary). I suspect this is another Tcl/Tk issue rather than a tkinter problem with this warning being because the MacOS API has changed slightly.
|
msg375605 - (view) |
Author: Prudent (Prudent) * |
Date: 2020-08-18 10:33 |
The versions of Python, Tcl/Tk and MacOS I used are 3.8.5, 8.5.9 and the newest Catalina 10.15.6, respectively.
Your words give me a hint about the version of Tcl/Tk. So I checked it. The version I used seems too old, the newest version for it is 8.6. In my thoughts, I always thought those embedded packages could be automatically upgraded after I re-installed a newer python. However, it seems the packages are not be updated as expected.
|
msg375606 - (view) |
Author: E. Paine (epaine) * |
Date: 2020-08-18 10:41 |
Ned, does it appear like Python is using the MacOS built-in Tcl version? My (very limited) understanding is that Python will default to the Tcl version packaged with it (which is currently 8.6.8).
|
msg375607 - (view) |
Author: Prudent (Prudent) * |
Date: 2020-08-18 10:58 |
Yes, you are right. Just now, I re-installed Python3.8.5. But when I opened my .py file with tkinter and ran it, it still linked to the old Tcl/Tk(8.5.9) in Python3.7.5. However, when I ran the command "python3 -m tkinter" to check its version. It showed me the new version 8.6. My understanding is that when a newer python is installed, the old files are not replaced. Both of them are kept in computer. Is it right? So, I should manually remove those old files, right?
|
msg375610 - (view) |
Author: Ronald Oussoren (ronaldoussoren) * |
Date: 2020-08-18 11:43 |
How did you install Python? Did you use the installer on Python.org or some other method?
A script that demonstrates the problem would be useful as well, I've tried to reproduce the problem in an interactive session in the terminal:
>>> from tkinter import filedialog
>>> filedialog.askopenfilename()
This works for me, I also don't get the warning in the attached image.
---
Which version of Tk is used depends on how Python is installed. The Python.org installers ship with a copy of Tk for use by Tkinter. Every version (3.7, 3.8, ...) you install ships with its own copy of Tk and won't use the copy of Tk from a different install.
Other distributions of Python (home-brew, anaconda, ...) might arrange thing differently.
|
msg375637 - (view) |
Author: Prudent (Prudent) * |
Date: 2020-08-19 06:09 |
Sorry, I forget how I installed the old python 3.7.5, but I installed the new python 3.8.5 using the downloaded installer from Python.org. Besides, I checked the "Tcl" under the path: "/System/Library/Tcl", its version still is 8.5. I think my code used the library here, and this is the reason why the warning showed.
|
msg375641 - (view) |
Author: Ronald Oussoren (ronaldoussoren) * |
Date: 2020-08-19 09:16 |
the version of Tk in /System is not relevant, as I wrote the Tkinter in the Python.org installer uses a copy of Tcl/Tk that's installed by the Python.org installer (somewhere in /Library/Frameworks/Python.framework).
This can be checked using the otool(1) command:
$ otool -vL /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload/_tkinter.cpython-38-darwin.so
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload/_tkinter.cpython-38-darwin.so:
/Library/Frameworks/Python.framework/Versions/3.8/lib/libtcl8.6.dylib (compatibility version 8.6.0, current version 8.6.8)
/Library/Frameworks/Python.framework/Versions/3.8/lib/libtk8.6.dylib (compatibility version 8.6.0, current version 8.6.8)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
As you can see _tkinter is linked with Tcl/Tk 8.6 inside the Python framework.
I'm also using the Python.org installer (although the system I tested on has a slightly out of date copy of Python 3.8) and don't get this warning. That might be because I've been testing something different from what you're doing.
Could you attach a script that demonstrates the problem?
|
msg375643 - (view) |
Author: Prudent (Prudent) * |
Date: 2020-08-19 10:03 |
Sorry, maybe I missed to share a critical point that I wrote Python codes using “VS Code” software, rather than IDEL. That warning only showed in VS Code software when I ran it. After I re-opened my code in IDEL and ran it again. No any warnings or errors existed at all.
|
msg375644 - (view) |
Author: Ronald Oussoren (ronaldoussoren) * |
Date: 2020-08-19 11:40 |
Weird. Maybe VS Code uses a different Python installation? You can add "import sys; print(sys.prefix)" to your script to check.
|
msg375687 - (view) |
Author: Prudent (Prudent) * |
Date: 2020-08-20 06:37 |
It is also very weird to me. I checked the python version used in VS code, the version in use was 3.8. But it seems the used Tcl/Tk package still linked to the system-embedded Tck/Tk 8.5.9 on macOS.
I found this description from "https://www.python.org/download/mac/tcltk/", which may help us know more. Anyway, this warning doesn't affect running codes too much.
|
msg375699 - (view) |
Author: Ronald Oussoren (ronaldoussoren) * |
Date: 2020-08-20 11:12 |
But does VS Code use the installation of 3.8 your expecting (the one in /Library/Frameworks/Python.framework)?
I'm closing the issue because this appears to be a problem with 3th-party code (VS Code), not with the Python.org installer.
|
msg375700 - (view) |
Author: Prudent (Prudent) * |
Date: 2020-08-20 11:13 |
Yes, I agree with you.
|
|
Date |
User |
Action |
Args |
2022-04-11 14:59:34 | admin | set | github: 85746 |
2020-08-20 11:13:56 | Prudent | set | messages:
+ msg375700 |
2020-08-20 11:12:05 | ronaldoussoren | set | status: open -> closed resolution: third party messages:
+ msg375699
stage: resolved |
2020-08-20 06:37:02 | Prudent | set | messages:
+ msg375687 |
2020-08-19 11:40:35 | ronaldoussoren | set | messages:
+ msg375644 |
2020-08-19 10:03:03 | Prudent | set | messages:
+ msg375643 |
2020-08-19 09:16:21 | ronaldoussoren | set | messages:
+ msg375641 |
2020-08-19 06:09:55 | Prudent | set | messages:
+ msg375637 |
2020-08-18 11:43:36 | ronaldoussoren | set | messages:
+ msg375610 |
2020-08-18 10:58:46 | Prudent | set | messages:
+ msg375607 |
2020-08-18 10:41:33 | epaine | set | messages:
+ msg375606 |
2020-08-18 10:33:30 | Prudent | set | messages:
+ msg375605 |
2020-08-18 09:59:27 | epaine | set | nosy:
+ epaine messages:
+ msg375604 components:
+ Tkinter
|
2020-08-18 08:50:45 | Prudent | create | |