Title: adding global variable to keep track if gtkmain has been called by fariza · Pull Request #2604 · matplotlib/matplotlib · GitHub
Open Graph Title: adding global variable to keep track if gtkmain has been called by fariza · Pull Request #2604 · matplotlib/matplotlib
X Title: adding global variable to keep track if gtkmain has been called by fariza · Pull Request #2604 · matplotlib/matplotlib
Description: When embedding plot creation in gtk (see example below) The mainloop does not call Gtk.main() because it has been called by the embedder. But Gtk.main_quit() is called depending on is_interactive(), it doesn't take in count who called Gtk.main() This causes that the embedder program, gets destroyed when destroying the last window of the plots. The proposed solution is just an ugly variable added to keep track if Gtk.main() was called inside the mainloop to restrict the call of Gtk.main_quit() This may be related to PR #2503 import matplotlib matplotlib.use('GTK3AGG') import matplotlib.pyplot as plt from gi.repository import Gtk class MyWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Hello World") self.button = Gtk.Button(label="Click Here") self.button.connect("clicked", self.on_button_clicked) self.add(self.button) def on_button_clicked(self, widget): fig = plt.figure() ax = fig.add_subplot(111) ax.plot([1,2,3]) plt.show() win = MyWindow() win.connect("delete-event", Gtk.main_quit) win.show_all() Gtk.main()
Open Graph Description: When embedding plot creation in gtk (see example below) The mainloop does not call Gtk.main() because it has been called by the embedder. But Gtk.main_quit() is called depending on is_interactive()...
X Description: When embedding plot creation in gtk (see example below) The mainloop does not call Gtk.main() because it has been called by the embedder. But Gtk.main_quit() is called depending on is_interactive()...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/2604
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:15fc89b3-2a03-2662-a919-f19d6001ad10 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 81A6:108FC:8B40BB:BA75BF:6A5310AB |
| html-safe-nonce | 86057eeac70ad1af0c9853a389bc082f803fa18c363ca1a8759b0a6c46323ab4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MUE2OjEwOEZDOjhCNDBCQjpCQTc1QkY6NkE1MzEwQUIiLCJ2aXNpdG9yX2lkIjoiMzA3NjE4MDgyOTAxNTMxNDYwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | db705ef5299144ace8a4f886eea6d2bfa3413aee912dea538113a9f2c6b51dc1 |
| hovercard-subject-tag | pull_request:10154483 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/matplotlib/matplotlib/pull/2604/files |
| twitter:image | https://avatars.githubusercontent.com/u/1490153?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1490153?s=400&v=4 |
| og:image:alt | When embedding plot creation in gtk (see example below) The mainloop does not call Gtk.main() because it has been called by the embedder. But Gtk.main_quit() is called depending on is_interactive()... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width