I'm trying to create a scroll full of checkboxes but I'm having 3 problems:
- I can't center the scroll sidebar
- I can't define a scroll size of my choice
- it seems that if the mouse is over the checkboxes the scroll doesn't work and I have to go to an area without checkboxes
This is my code:
text = tk.Text(self, cursor="arrow")
vsb = tk.Scrollbar(self, command=text.yview)
vsb.grid(row=7, column=4, rowspan=2, sticky='nse')
text.configure(yscrollcommand=vsb.set, width=20)
text.grid(row=7, column=4, rowspan=2, columnspan=1)
self.checkbuttons = []
self.vars = []
for i in range(20):
var = tk.IntVar(value=0)
cb = tk.Checkbutton(text, text="checkbutton #%s" % i, variable=var, onvalue=1, offvalue=0)
text.window_create("end", window=cb)
text.insert("end", "\n")
self.checkbuttons.append(cb)
self.vars.append(var)
text.configure(state="disabled")
I'm also open to other solutions but basically I need a scroll with a variable number of checkboxes inside. and I would like the scroll size to be well defined
Aucun commentaire:
Enregistrer un commentaire