0

I'm creating a ttk.Treeview widget, using python3.8 I do not want the #0 column to stretch. I've tried every possible value for the "stretch" attribute to no avail.

stretch=tk.NO

stretch=False

stretch=0

Below is a example snippet

alarmframe = ttk.Treeview(master,selectmode='extended')
alarmframe['columns'] = ("alarmname","timestamp")
alarmframe.pack(side='top',anchor='nw')
alarmframe.column("#0",width=20,stretch=False)
      
for row in range(6) :
   alarmframe.insert('','end',values=("Alarm" + str(row)) ```
  • It doesn't appear to me that column 0 is stretching. When I run your code, column 0 looks to be as small as it can be. When I adjust your code so that the tree fills the window, when I resize the window I don't see column #0 stretching when I use `stretch=False`. – Bryan Oakley Oct 15 '20 at 15:50
  • Do you mean not allow column '#0' being resized manually by dragging the separator in the heading? – acw1668 Oct 15 '20 at 16:07
  • Yes. I do not want column #0 to resize when dragging the separator heading. thank you – MicheleJoyce Oct 15 '20 at 16:48
  • I don't think `stretch` will prevent the user from resizing that column. – Bryan Oakley Oct 15 '20 at 17:14
  • You might want to take a look at this answer, if your ultimate goal is to prevent the user from resizing that first column: https://stackoverflow.com/a/46120502/7432 – Bryan Oakley Oct 15 '20 at 17:39

0 Answers0