when building a checkbutton list (3,000 cases) the list is cut off.
Here is a small sample:
import tkinter as tk
class Example(tk.Frame):
def __init__(self, parent):
tk.Frame.__init__(self, parent)
self.canvas = tk.Canvas(self, borderwidth=0, background="#ffffff")
self.frame = tk.Frame(self.canvas, background="#ffffff")
self.vsb = tk.Scrollbar(self, orient="vertical", command=self.canvas.yview)
self.canvas.configure(yscrollcommand=self.vsb.set)
self.vsb.pack(side="right", fill="y")
self.canvas.pack(side="left", fill="both", expand=True)
self.canvas.create_window((4,4), window=self.frame, anchor="nw",
tags="self.frame")
self.frame.bind("<Configure>", self.onFrameConfigure)
self.populate()
def populate(self):
for row in range(3000):
t="Example -Checkbutton %s" %row
button = tk.Checkbutton(self.frame, padx=7, relief=tk.RIDGE, text=t,
onvalue=1, offvalue=0, font='Courier 12')
button.grid(row=row, column=1, sticky='news')
def onFrameConfigure(self, event):
self.canvas.configure(scrollregion=self.canvas.bbox("all"))
if __name__ == "__main__":
root=tk.Tk()
example = Example(root)
example.pack(side="top", fill="both", expand=True)
root.mainloop()
The output of the program:
| | Example checklist 0
| | Example checklist 1123
| | Example checklist 1126
| | Example checklist 1125
| | Example checklist 2999
The example checklists 1126 - 2998 are not displayed and the example checklist 2999 is indicated by a double line.
Is there a parameter that shows the complete list?