python - scrollbar for labels frame in tkinter -
i trying create scroll bar window created in gui using tk.toplevel. frame fills long grids of strings added 1 buy one. rest of gui allows user write series of fields displayed 1 after using grid.
the data might this:
sadas sfafaf fsaafads fdsafsf dfsfdsf fssfs fsfsfsfs fsfsfs sfsfsfs fsssfsfsf
sadas sfafaf fsaafads fdsafsf dfsfdsf fssfs fsfsfsfs fsfsfs sfsfsfs fsssfsfsf
sadas sfafaf fsaafads fdsafsf dfsfdsf fssfs fsfsfsfs fsfsfs sfsfsfs fsssfsfsf
i used post: adding scrollbar group of widgets in tkinter guide right now. currently, when open window scroll bar appears on left side. add line gui freezes , have close it.
here relevant code:
class data_popup(): def __init__(self, parent): self.parent = parent self.top = tk.toplevel(parent) self.top.title("current data") self.top.protocol('wm_delete_window', self.stop_close) #frames self.header_labels_frame = tk.frame(self.top) self.header_labels_frame.pack(side = tk.top) self.data_frame_1 = tk.frame(self.top) self.data_frame_1.pack(side = tk.bottom) self.header_labels_list = [] self.data_canvas = tk.canvas(self.data_frame_1, borderwidth = 0) self.data_frame = tk.frame(self.data_canvas) self.scrollbar = tk.scrollbar(self.data_frame, orient = 'vertical', command = self.data_canvas.yview) self.data_canvas.configure(yscrollcommand = self.scrollbar.set) self.scrollbar.pack(side = 'right', fill = 'y') self.data_canvas.pack(side = "bottom", fill = 'both', expand = true) self.data_canvas.create_window((4,4), window = self.data_frame, anchor = 'nw', tags = "self.frame") self.data_frame.bind("<configure>", self.myfunction) self.create_header() self.data_row_list = list() def myfunction(self, event): self.data_canvas.configure(scrollregion=self.data_canvas.bbox("all"))
often, when gui freezes in manner describe, because use both grid
, pack
in same frame. aren't showing code add frame, guess is, happening.
Comments
Post a Comment