0

I created a series of checkbutton with text(cb in the example), and I put them into a canvas with the create_window method (I need that because I have a Scrollbar). How can I extend this code and get my checkbuttons sticky to left and right border?

canvas.create_window(0, i*20,       #for non overlapping
                     window= cb[key],
                     anchor = NW) 

1 Answers1

0

You're going to have to compute the width of the window and specify that when you create the item.

The alternative is to put all of the checkbuttons in a frame using pack, place or grid, and then have a single create_window for the frame. That's the more common way of using a canvas to scroll a bunch of widgets.

For an example of using a frame embedded in a canvas, see this answer:

Community
  • 1
  • 1
Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685