Open
Description
Bug report
Bug summary
Typing a dead key (a key which is not written directly after a keypress, e.g. ^, ´, `) into a TextBox widget raises a TypeError. This also occurs when you press CapsLock. This prevents the user from entering some characters like "^" or using CapsLock.
Edit: After about version 3.4
no error is being raised. Now CapsLock works but the TextBox just ignores dead keys.
Code for reproduction
from matplotlib import pyplot as plt
from matplotlib.widgets import TextBox
fig, ax = plt.subplots(figsize=(6, 3))
fig.subplots_adjust(bottom=0.2)
text_box_ax = fig.add_axes([0.4, 0.02, 0.5, 0.06])
text_box = TextBox(text_box_ax, "Type diacritic character (e.g. ^): ")
plt.show()
Actual outcome
Traceback (most recent call last):
File "\matplotlib\cbook\__init__.py", line 196, in process
func(*args, **kwargs)
File "\matplotlib\widgets.py", line 790, in _keypress
if len(key) == 1:
TypeError: object of type 'NoneType' has no len()
Expected outcome
Normal behaviour of those characters when typing them in editors or searchbars etc.
Matplotlib version
- Operating system: windows 10, build 19041.867
- Matplotlib version:
3.2.2
- Matplotlib backend:
TkAgg
- Python version: 3.8
- Jupyter version (if applicable):
- Other libraries: