canvas - Python Tkinter scrollbar in multiple tabs -


i learned how make scrollable frame embedding frame in canvas , adding scrollbar this:

def __add_widget_features(self, feat_tab):     table_frame = ttk.frame(feat_tab)     table_frame.pack(fill=both, expand=true)     self.__make_grid(table_frame)      ####subframe####                   self.canvas = canvas(table_frame, borderwidth=0, background="#ffffff")     self.frame = labelframe(self.canvas, background="#ffffff", text="timetable")     self.vsb = ttk.scrollbar(table_frame, orient="vertical", command=self.canvas.yview)     self.canvas.configure(yscrollcommand=self.vsb.set)      self.vsb.pack(side="right", fill="y")     self.canvas.pack(side="right", fill="both", expand=true)     self.canvas.create_window((4,4), window=self.frame, anchor="nw",                                tags="self.frame")      self.frame.bind("<configure>", self.onframeconfigure) 

my program has gui creates multiple tabs. scrollable canvas works great in 1 tab, when try add same code second tab, scrollbar doesn't work on tab. if comment out code block on first tab, works fine on other one. i've tried naming of elements of second tab different (in case problem) , i've tried taking out "self." part of names none of helped. i'm quite new python i'm sure i'm missing simple. tried posting picture of problem rep isn't high enough yet. great.

update: per brionius's suggestion, here's function creating notebook:

def __add_widget_datawindow(self):     '''(fordtipgui) -> nonetype     populate data_window widgets.     '''      # add data_window frame     data_frame = ttk.frame(self.data_window)     data_frame.pack(fill=both, expand=true)     self.__make_grid(data_frame)     self.add_menubar(self.data_window, "other") # add menubar      # add subframes , make them grid     button_frame = ttk.frame(data_frame)     button_frame.grid(row=9, column=0, rowspan=1, columnspan=10,sticky=w+e+n+s)     self.__make_grid(button_frame)     nb_frame = ttk.frame(data_frame)     nb_frame.grid(row=0, column=0, rowspan=9, columnspan=10, sticky=w+e+n+s)      ## add widgets subframes ##      # button_frame     disc_button = ttk.button(button_frame, text="disconnect", command=lambda:self.disconnect())     disc_button.grid(row=10, column=0, columnspan=1, sticky=w+e+n+s)      # nb_frame     nb = ttk.notebook(nb_frame) # create notebook     nb.pack(fill=both, expand=true)      # create frames tabs     tab_frame1 = ttk.frame(nb)     tab_frame2 = ttk.frame(nb)     tab_frame3 = ttk.frame(nb)     tab_frame4 = ttk.frame(nb)     tab_frame5 = ttk.frame(nb)     self.__make_grid(tab_frame1)     self.__make_grid(tab_frame2)     self.__make_grid(tab_frame3)     self.__make_grid(tab_frame4)     self.__make_grid(tab_frame5)      # add tabs     nb.add(tab_frame1, text='confidential1 view')     nb.add(tab_frame2, text='confidential2 view')     nb.add(tab_frame3, text='confidential3 view')     nb.add(tab_frame4, text='confidential4 view')     nb.add(tab_frame5, text='confidential5 view')      # add widgets     self.__add_widget_group(tab_frame1)     self.__add_widget_feature(tab_frame2)     self.__add_widget_signal(tab_frame3)     self.__add_widget_features(tab_frame4)     self.__add_widget_timetable(tab_frame5) 

pic of problem: http://www.use.com/supersize.pl?set=3059c6e412c1416578a7

you doing wrong parent/child relationships. @ code:

def __add_widget_timetable(self, timetable_tab):     table_frame = ttk.frame(feat_tab)     table_frame.pack(fill=both, expand=true)     self.__make_grid(table_frame) 

notice how you're passing in frame (timetable_tab), creating tab (table_frame), , putting created frame in other frame (feat_tab).

something seems rather wrong. guess table_frame should child of timetable_tab.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -