Skip to content

Set widget background color to white. #9698

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

Merged
merged 2 commits into from
Nov 9, 2017
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Nov 6, 2017

PR Summary

Set widget background to white.

The background color of the widget can be seen by setting a transparent
figure facecolor, e.g.

from pylab import *
rcParams["figure.facecolor"] = (0, 0, 0, 0); gca(); show()

The goal is to ultimately replace setting savefig.transparent by
figure.facecolor = (0, 0, 0, 0).
(see #9080 for example for the slight trickiness of savefig.transparent).

As far as I can tell, gtk3 already defaults to a white background. Not
sure what the situation is on OSX.

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

super(FigureCanvasQT, self).__init__(figure=figure)

figure._original_dpi = figure.dpi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the super chain no longer use _original_dpi?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT the only places it is accessed are _update_figure_dpi (which is called later) and print_figure (which is irrelevant here).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this got sorted out as part of the initial draw / re-entrant paint fix.

@tacaswell tacaswell added this to the v2.2 milestone Nov 6, 2017
Copy link
Contributor

@dopplershift dopplershift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Just need to rebase to resolve the conflict.

@anntzer
Copy link
Contributor Author

anntzer commented Nov 7, 2017

Done.

Also removed _onEraseBackground from wx, which I forgot to do together with https://github.com/matplotlib/matplotlib/pull/9697/files#diff-19c3295dfd86eed49da406f5e5296055L687.

The background color of the widget can be seen by setting a transparent
figure facecolor, e.g.

    from pylab import *
    rcParams["figure.facecolor"] = (0, 0, 0, 0); gca(); show()

The goal is to ultimately replace setting `savefig.transparent` by
`figure.facecolor = (0, 0, 0, 0)`.

As far as I can tell, gtk3 already defaults to a white background.  Not
sure what the situation is on OSX.
@anntzer
Copy link
Contributor Author

anntzer commented Jan 31, 2021

Actually I guess the situation on gtk depends on the desktop theme; it doesn't work on a dark theme for me. A fix is at #19410.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants