ich will Checkbuttons mit Short cuts (Alt-1, Alt-2, ... ) belegen:
Code: Alles auswählen
import Tkinter as tk
def myQuit():
quit()
root=tk.Tk()
var = tk.StringVar()
tk.Checkbutton(text="hallo", onvalue=1, variable = var).pack()
tk.Checkbutton(text="hallo2", onvalue=2, variable = var).pack()
c=tk.Checkbutton(text="hallo3", onvalue=3, variable = var).pack()
#c.bind('<F1>',lambda e:myQuit())
#c.bind('<Alt>+<1>',lambda e:myQuit())
#c.bind('<Alt>+<F1>',lambda e:myQuit())
tk.Button(text = "ausgabe").pack()
root.bind('<Escape>',lambda e:myQuit())
tk.mainloop()
Natürlich will ich mit den shortcuts der Checkbuttons kein quit ausführen, es sollen nur die buttons ausgewählt werden, also der Aufruf von bind ohne Funktionsaufruf: ....bind('<F1>'). Das ist aber der zweite Schritt, zunächst schaffe ich es gar nicht einen Short cut einem Checkbutton zuzuordnen.AttributeError: 'NoneType' object has no attribute 'bind'
Gruss Eckard