Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Simplify get_current_fig_manager().#14085
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
timhoffm left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
get_current_figure_manager() is definitively nothing that should be in the user-facing pyplot API.
Not sure is should stay as a private function or maybe as a method ofFigure. The deep nestinggcf().canvas.manager feels like there's a proper interface layer missing, but I'm not enough into the manager business to judge that.
anntzer commentedApr 29, 2019
I think the number of cases where a end user needs to access a manager is rare enough that being one additional layer deep is not something to worry about (basically, it's (mostly) only relevant when they're using pyplot to create the figures, but then still want to do stuff with the underlying toolkit widget...). |
timhoffm commentedApr 29, 2019
I was more thinking along the lines: If people use the high-level pyplot API, the shouldn't have to do anything with managers. That mentioned additional layer would more be for experts and for having an internal clean structure. |
tacaswell commentedApr 29, 2019
Accessing the manager can be very useful for setting custom window titles after the fact (which in turn controls how they show up in the task bar). |
anntzer commentedApr 29, 2019
Fair enough, however the point that gcf().canvas.manager is shorter to type and avoids adding API layers for the sake of it remains :) |
timhoffm commentedApr 30, 2019
I have still no clear view what a figure manager does and how the relations between
Attempt do define what the classes are for: Depending on what the manager is actually meant for, it makes sense or not to keep it accessible directly through pyplot. I could also imagine that it makes sense to access the manager through the |
Withdrawing my approval for now as I've realized I don't really understand this stuff.
anntzer commentedApr 30, 2019
Very briefly, the FigureManager is what holds onto the native qt/gtk/wx/tk window that pyplot sets up to hold the canvas. |
ImportanceOfBeingErnest commentedApr 30, 2019
According to stackoverflow Q&As the main/most popular use case of Answers of this type have an accumulated number of some >50 votes. This seems like a clear sign that there is a lot of code in the wild that would suffer from the deprecation. In that sense, what is the benefit of removing it? |
anntzer commentedApr 30, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
If you're already doing something backend dependent, you should just do |
tacaswell commentedApr 30, 2019
I am 👍 on the internal changes, 👎 on deprecating it (there is no maintenance burden on it and as@ImportanceOfBeingErnest there would be a real user-cost to this change), 👍 for changing the docstring to saying "use this other thing instead". @timhoffm In most (all?) cases the |
timhoffm commentedApr 30, 2019
In the context of what I've understood so far, I'm in favor of leaving Even though the name is not great, this is the way to access the backend-specific window etc. In contrast, I see |
86fe348 tod496e77CompareAlso make ``plt.subplot_tool`` work even for non-pyplot-managed figures-- there's no reason not to, it's just that such figures cannot be madethe "current" pyplot figure.
d496e77 toe615fe5Compareanntzer commentedApr 30, 2019
To move this forward, I reverted the deprecation and just put in the simpler implementation and docstring. |
It's longer to type(!) than its actual implementation
(
gcf().canvas.manager), and mixes the pyplot and the OO-interfaces.Also make
plt.subplot_toolwork even for non-pyplot-managed figures-- there's no reason not to, it's just that such figures cannot be made
the "current" pyplot figure.
PR Summary
PR Checklist