Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

macOS: Check for display availability when looking for backends#27761

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
QuLogic wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromQuLogic:mac-display-check

Conversation

QuLogic
Copy link
Member

PR summary

This checksNSScreen::mainScreen similar to checking$DISPLAY/$WAYLAND_DISPLAY on Linux.

Fixes#26292

PR checklist

@QuLogicQuLogic added this to thev3.9.0 milestoneFeb 8, 2024
@QuLogicQuLogic mentioned this pull requestFeb 8, 2024
1 task
@tacaswell
Copy link
Member

I can confirm that this:

  • logged in (but locked) with screen plugged in -> True
  • logged in (but locked) with the hdmi unplugged -> True
  • logged out -> False

@tacaswell
Copy link
Member

Running the tests on this branch locally without a user logged in to the desktop (so launched via ssh) I get:

ERROR lib/matplotlib/tests/test_backend_macosx.py::test_cached_renderer - ImportError: Cannot load backend 'macosx' which requires the 'macosx' interactive framework, as 'headless' is currently runningERROR lib/matplotlib/tests/test_backend_macosx.py::test_savefig_rcparam - ImportError: Cannot load backend 'macosx' which requires the 'macosx' interactive framework, as 'headless' is currently running

This suggests that what is going on the CI is slightly different than not having a display?

@QuLogic
Copy link
MemberAuthor

QuLogic commentedFeb 8, 2024
edited
Loading

On Actions, the display does appear to exist, according to the results from#27723:

mainScreen: Built-in Display (1920.000000x1080.000000)+0.000000+0.000000 @8deepestScreen: Built-in Display (1920.000000x1080.000000)+0.000000+0.000000 @8Available screens: 1    0: Built-in Display (1920.000000x1080.000000)+0.000000+0.000000 @8

For your failures, I think that's because the macOS tests don't have a skip, so I hadn't added one (only modified existing ones.)

@QuLogicQuLogic marked this pull request as ready for reviewFebruary 8, 2024 21:24
@tacaswell
Copy link
Member

I tried re-running the failed mac3.11 jobs.

@QuLogic
Copy link
MemberAuthor

Looking athttps://stackoverflow.com/questions/71954472/tkinter-crashes-on-ipython-but-not-in-python-on-a-m1-mac I think this might be becauseNSApplicationLoad messes with Tkinter somehow. I thought they were shared instances, but there must be something Tkinter is doing that confuses it if we create one ourselves.

@QuLogic
Copy link
MemberAuthor

QuLogic commentedFeb 9, 2024
edited
Loading

Ah, here's afull explanation:

  • Both pyglet and Tk use AppKit to implement their GUI
  • AppKit uses an NSApplication class, and in particular a singleton instance of that class, to represent the application, which will get instantiated during application startup
  • The Tk library uses a sublclass of NSApplication with additional functionality (TkApplication).
  • When pyglet is started first the NSApplication singleton is an instance of NSApplication and not of TkApplication, but Tk's implementation assumes that the singleton is an instance of TkApplicationo.

but substitute the new code written here forpyglet above.

AFAICT from Googling though, we need theNSApplication instance to be sure that theNSScreen attributes are filled, though I've not tested it out myself.

Can you check if it works without theNSApplicationLoad?

@QuLogicQuLogic marked this pull request as draftFebruary 9, 2024 07:35
@QuLogicQuLogic modified the milestones:v3.9.0,v3.10.0Apr 2, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@greglucasgreglucasgreglucas approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
future releases
Development

Successfully merging this pull request may close these issues.

[Bug]: macOS backend run by non-logged-in user crashes in Ventura
3 participants
@QuLogic@tacaswell@greglucas

[8]ページ先頭

©2009-2025 Movatter.jp