I have an application with a Text widget, and I want my font to get smaller when the user presses the Control key and the minus key (-).
the code
self.bind_all("<Control-=>", self.increaseFont)
seems to work fine for getting the font to increase when the user presses the control key and the equals key, but the line
self.bind_all("<Control-->", self.decreaseFont)
does not seem to work.
When I try to run it, it gives me a runtime error:
Traceback (most recent call last):
File "./mathEditor.py", line 122, in <module>
app = MathEditor(fileName = sys.argv[1])
File "./mathEditor.py", line 40, in __init__
self.bind_all("<Control-->", self.decreaseFont)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 997, in bind_all
return self._bind(('bind', 'all'), sequence, func, add, 0)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 940, in _bind
self.tk.call(what + (sequence, cmd))
_tkinter.TclError: no event type or button # or keysym
Try self.bind_all("<Control-minus>", self.decreaseFont).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With