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

pyimagej interefering with Tkinter GUI on Mac #39

Open
jluethi opened this issue May 31, 2019 · 2 comments
Open

pyimagej interefering with Tkinter GUI on Mac #39

jluethi opened this issue May 31, 2019 · 2 comments
Labels
bug Something isn't working macos-gui
Milestone

Comments

@jluethi
Copy link

jluethi commented May 31, 2019

I have an application using pyimagej for image processing and want to make a very simple interface for the users to provide some inputs. I am using tkinter for this gui. When I initialize pyimagej either in that script or one of its imports, it fails to produce the gui, but does not crash. It just shows the following message:
2019-05-31 16:47:01.581 python[27137:9099880] In -[NSApplication(NSQuietSafeQuit) _updateCanQuitQuietlyAndSafely], _LSSetApplicationInformationItem(NSCanQuitQuietlyAndSafely) returned error -50

Here is some dummy example code that reproduces this:

import imagej
import tkinter as tk
ij = imagej.init('sc.fiji:fiji:2.0.0-pre-10')
root = tk.Tk()
tk.Label(root, text='Test1').grid(row=0, column=0)
tk.Checkbutton(root, text='Test2').grid(row=1, column=0)
root.mainloop()

Without the imagej initialization, it runs fine. It happens both with a maven initialization and when wrapping the local Fiji installation. This problem does not reproduce on Windows for me (there, the gui comes up as expected) and I don't know whether it reproduces on Linux.
I do get this issue on my Mac running macOS 10.14.5.

@ctrueden
Copy link
Member

I am guessing this is related to Python GUI support on macOS. Might be related to macOS threading and the Cocoa event loop (see also #23)?

Things to try:

  1. You could try running with a framework build of Python i.e. pythonw instead of python.
  2. You could try using this approach to launch your script and see if it makes any difference.

@jluethi
Copy link
Author

jluethi commented May 31, 2019

Thanks @ctrueden ! This currently isn't a priority for me, as our production runs on Windows. Just wanted to document the issue for the moment.
If I get to check this out later, I'll report back. Thank you!

@ctrueden ctrueden added this to the unscheduled milestone Dec 2, 2019
@ctrueden ctrueden added bug Something isn't working macos-gui labels Jun 23, 2023
jschneidereit pushed a commit to jschneidereit/pyimagej that referenced this issue Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working macos-gui
Projects
None yet
Development

No branches or pull requests

2 participants