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
[ENH]: Support "window_move_event" in canvas.mpl_connect #25351
Comments
|
My knee-jerk threshold question on this is if the underlying UI frameworks (Qt, gtk, wx, tk, osx) give us a signal (on all of the platforms) we can listen to to be notified when the window is moved. If yes for all, this is probably non-controversial if someone does the work. If no for some we would have to have a think about if we want to give up feature parity. If none of them provide this hook I suspect this is a no-go. A only slightly manual work around would be to make Keeping a global registry of figure location is well outside of Matplotlib's scope and should be managed by the application. Mostly joking, have you considered using qtile (https://docs.qtile.org/en/latest/manual/install/)? Unsolicited API comments: pass the |
Yes, exactly. It seems like an obviously missing callback, since only half of the geometry tuple is covered, so I wondered if there was a known reason this signal isn't included. It makes sense that application windows need to know their size but not their position, so maybe UI frameworks tend not to provide the position? I thought you might have some idea offhand; if not I can look into it (at some point).
Is that "all" of the frameworks, or all valid combinations of (framework, platform)?
Are there any official guidelines on how this is normally approached? It seems that this is already somewhat of an issue (e.g. https://stackoverflow.com/questions/7449585/how-do-you-set-the-absolute-position-of-figure-windows-with-matplotlib).
This occurred to me as well, I just need to look up how to do buttons. This might be more realistic, at least short term. If the position callback approach is feasible, I would love to contribute it eventually. I realized that this problem has been nagging at me subconsciously for years, and I have to imagine it would be useful for others too. I also realize anyone using Jupyter/Spyder/PyCharm/etc has a slick solution already, but I imagine there is still room for the callback to be useful. I appreciate any API comments from you; my intent with that prototype was to make the usage as concise as possible, without paying much attention to the Right Way to do it. I'm open to any suggestions - I love the idea of tiling window managers, and ideally I would like to get in the habit of using one. i3 is on my todo list, but I will consider qtile as well. Do you use it effectively with Matplotlib? Frankly, I have become frustrated with the feature update/retirement cycle of Linux desktop environments. I now tend to use stock Ubuntu, to minimize the amount of effort I need to put into fixing customizations as they break. Thanks for your input! |
all combinations, but the frameworks are pretty good about feature parity across platforms.
yes, with a cut out that figures (well windows with the name |
|


Problem
Proposed solution
I have created a quick prototype wrapper class
PersistentFigurewhich serves as a rough proof of concept. Essentially, it simply creates a figure, and connects a callback toresize_event, which writes the geometry tuple to a JSON file, as a dict value, keyed with something likehostname-filename-functionname-figuretitle. This accomplishes most of what I want, with one problem: there is no callback event for moving a window, without resizing it. With this addition, myPersistentFigurewould do everything I want it to.I realize there are some likely issues with this, including:
If there are any good alternative ways to accomplish my overall goal, I would love to learn more about them.
The text was updated successfully, but these errors were encountered: