![]() ![]() w_results = ttk.Treeview(self, style = 'mystyle.Treeview') w_lumn("#0", minwidth = 1150)įWIW: I would suggest you make this into it's own widget, to keep it neater, and that way you would have a much easier time styling and testing it, and then you could even squirrel it away in a different file. So to do what you want you need to set the minwidth, not the width, or write some code that will adjust the column width to match the content. The thing you forgot is that the width argument is a suggestion that is overridden by the widget width, and things in a treeview column are allowed to be wider than the column. You'll see the horizontal scrollbar activate. Grab the column edge on the header bar and drag it around. w_results.insert('', tk.END, text = 'Some very long texxxxxxxt.') Self.cnt_id(row = 4, column = 0, padx = Application.DEF_X_PAD_LR, pady = Application.DEF_Y_PAD_TOP, sticky = "WE") Self.cnt_id_columnconfigure(0, weight = 1) # Configure and position grid for TreeView Sb_id(row = 1, column = 0, sticky = "ew") Sb_id(row = 0, column = 1, sticky = "ns") w_nfigure(yscrollcommand = sb_t, xscrollcommand = sb_t) Sb_horizontal = tk.Scrollbar(self.cnt_treeview, orient = "horizontal", command = w_results.xview) Sb_vertical = tk.Scrollbar(self.cnt_treeview, orient = "vertical", command = w_results.yview) ![]() # Scrollbars + attach scrollbars to TreeView w_results.heading('#0', text = 'Found results', anchor = tk.W) w_results = ttk.Treeview(self.cnt_treeview, style = 'mystyle.Treeview') self.cnt_treeview = tk.Frame(self.master, borderwidth=1, relief="sunken", height = 11) I'm trying to create a frame with scrollable treeview but only the vertical scrollbar works, not the horizontal one.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |