Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clicking the select file button will freeze on macOS 14.4 arm64 #473

Closed
jiayouzl opened this issue Mar 23, 2024 · 13 comments
Closed

Clicking the select file button will freeze on macOS 14.4 arm64 #473

jiayouzl opened this issue Mar 23, 2024 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@jiayouzl
Copy link

macos 14.4 arm64 最新版本的auto-to-exe无法选择文件,点击选择文件按钮,就卡死了.

@jiayouzl jiayouzl added the bug Something isn't working label Mar 23, 2024
Copy link

👋 Hi, just a reminder that if you haven't read the help post yet, give it a read to see if your issue is covered in it and make sure to follow the debugging section.

Also please note, as stated in the README, if your issue is only associated with your application and not auto-py-to-exe itself, please do not create an issue in this repository - instead, comment on the help post, video or create a new discussion.

@jiayouzl jiayouzl changed the title macos 14.4 arm64 最新版本的auto-to-exe无法选择文件,点击选择文件按钮,就卡死了. macOS 14.4 arm64 The latest version of auto-to-exe cannot select files, clicking the select file button will freeze. Mar 23, 2024
@brentvollebregt
Copy link
Owner

When you say "the latest version" - does an older version work for you currently?

@brentvollebregt brentvollebregt added question Further information is required and removed bug Something isn't working labels Mar 23, 2024
@jiayouzl
Copy link
Author

When you say "the latest version" - does an older version work for you currently?

All have this problem!

@brentvollebregt
Copy link
Owner

Does this look related to #304 by any chance?

If you run this script in Python, does it lead to the same issue?

from tkinter import Tk
from tkinter.filedialog import askopenfilename

root = Tk()
root.withdraw()
root.wm_attributes('-topmost', 1)
file_path = askopenfilename(parent=root)
root.update()
print(file_path)

@brentvollebregt brentvollebregt changed the title macOS 14.4 arm64 The latest version of auto-to-exe cannot select files, clicking the select file button will freeze. Clicking the select file button will freeze on macOS 14.4 arm64 Mar 23, 2024
@jiayouzl
Copy link
Author

Does this look related to #304 by any chance?

If you run this script in Python, does it lead to the same issue?

from tkinter import Tk
from tkinter.filedialog import askopenfilename

root = Tk()
root.withdraw()
root.wm_attributes('-topmost', 1)
file_path = askopenfilename(parent=root)
root.update()
print(file_path)

Yes, Python 3.9.19 encountered the same problem when running.

@jiayouzl
Copy link
Author

root.withdraw()

Delete the code line above and it will be normal.

@brentvollebregt
Copy link
Owner

brentvollebregt commented Mar 24, 2024

Great find, however when removing root.withdraw(), I imagine there is another small window that appears which looks like this:

image

Do you also get this same window?

Aside from answering that question, could you also try this:

from tkinter import Tk
from tkinter.filedialog import askopenfilename

root = Tk()
root.withdraw()
# root.wm_attributes('-topmost', 1)
file_path = askopenfilename(parent=root)
root.update()
print(file_path)

Wondering if root.wm_attributes('-topmost', 1) is the issue as it's trying to interact with a window that's no longer there.

@jiayouzl
Copy link
Author

Great find, however when removing root.withdraw(), I imagine there is another small window that appears which looks like this:

image

Do you also get this same window?

Aside from answering that question, could you also try this:

from tkinter import Tk
from tkinter.filedialog import askopenfilename

root = Tk()
root.withdraw()
# root.wm_attributes('-topmost', 1)
file_path = askopenfilename(parent=root)
root.update()
print(file_path)

Wondering if root.wm_attributes('-topmost', 1) is the issue as it's trying to interact with a window that's no longer there.

No, the problem is not solved.

@jiayouzl
Copy link
Author

jiayouzl commented Mar 24, 2024

I tried to change the code, and the final code is as follows. You can refer to it, and my test here is already working properly.

# -*- coding: UTF-8 -*-

from tkinter import Tk
from tkinter.filedialog import askopenfilename

root = Tk()
root.withdraw()

root.wm_attributes('-topmost', 1)
file_path = askopenfilename()
root.update()
print(file_path)

@brentvollebregt
Copy link
Owner

Oh, that's really interesting; dropping parent=root from the askopenfilename call. Thank you very much for testing this - I'll take a look at that parameter and see if it makes sense to drop.

@brentvollebregt brentvollebregt added bug Something isn't working and removed question Further information is required labels Mar 24, 2024
@brentvollebregt
Copy link
Owner

I've just released auto-py-to-exe 2.43.2 with this change - hopefully this fixes the issue. Let me know if it doesn't and we can look into this more.

@jiayouzl
Copy link
Author

I've just released auto-py-to-exe 2.43.2 with this change - hopefully this fixes the issue. Let me know if it doesn't and we can look into this more.

Okay, 2.43.2 can be used now.

There are still some minor issues, such as after selecting a file once, when selecting the file again, the file selection dialog is in the background of the program instead of in the foreground, and you have to manually bring it up.

@brentvollebregt
Copy link
Owner

There are still some minor issues, such as after selecting a file once, when selecting the file again, the file selection dialog is in the background of the program instead of in the foreground, and you have to manually bring it up.

I've just put a change on the master branch that may fix this. Instead of creating a new tkinter.Tk object each time, only one is created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants