Skip to content

Give the Tk toolbar buttons a flat look - #22174

Merged
QuLogic merged 1 commit into
matplotlib:mainfrom
daniilS:tk_toolbar_buttons
Jan 21, 2022
Merged

QuLogic merged 1 commit into
matplotlib:mainfrom
daniilS:tk_toolbar_buttons

Conversation

@daniilS

@daniilS daniilS commented Jan 9, 2022

Copy link
Copy Markdown
Contributor

PR Summary

This changes the parameters of the buttons in the Tk navigation toolbar to give them a flat look (with an outline showing when the mouse is over the button), similar to the Qt backend. For comparison:
Old:
old
New:
new

@timhoffm timhoffm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this looks nicer and more modern.

b = tk.Button(master=self, text=text, command=command)
b = tk.Button(
master=self, text=text, command=command,
relief="flat", overrelief="groove", borderwidth=1,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is the border width inside or outside the button? Just wondering if the size we allocate is consistent on HiDPI screens?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's outside of the button, and the default width seems to be 2, so space shouldn't be an issue.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm more concerned about the height of the toolbar than the width of the border itself.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The toolbar height is set to the height of two text lines here, which on all platforms I've tried is bigger than the size of the buttons, so the buttons becoming 2px smaller shouldn't affect the height of the toolbar.

@QuLogic
QuLogic merged commit f393802 into matplotlib:main Jan 21, 2022
@daniilS
daniilS deleted the tk_toolbar_buttons branch January 21, 2022 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants