8000 Added a TextBox widget by keflavich · Pull Request #1983 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Added a TextBox widget #1983

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

Closed
wants to merge 26 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove redraw option from set_text
  • Loading branch information
Matt Terry committed Jun 5, 2013
commit 42b8489beac961cafa2a10a4165d7a7d4a90b00f
6 changes: 1 addition & 5 deletions lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1804,7 +1804,7 @@ def keypress(self, event):
self.cursor.set_xdata([r, r])
self.redraw()

def set_text(self, text, redraw=False):
def set_text(self, text):
try:
# only try to update if there's a real value
if (not(text.strip() in ('-.','.','-',''))
Expand All @@ -1815,10 +1815,6 @@ def set_text(self, text, redraw=False):
except ValueError:
pass

if redraw:
self.text.draw(self.text._renderer)
self.redraw()

def _get_text_right(self):
bbox = self.text.get_window_extent()
Copy link
Contributor

Choose a reason for hiding this comment

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

This get_window_extent() causes problems on MacOSX. (related to the blitting problems with macosx). You can get around it by calling self.canvas.draw() before get_window_extent(), but that can be laggy. If you check the backend, you can only inflict the lag on macosx users. But then you're putting backend checks into supposedly backend independent widgets.

Any less hacky ideas of how to get the rendered width of a block of text?

l, b, w, h = bbox.bounds
Expand Down
0