Creates a new tab, and returns it's corresponding frame
(self, width = 2, **kw)
| 88 | self.tabVars[i][0]['fg'] = self.activefg #Set the fg of the tab, showing it is not selected, default is black |
| 89 | |
| 90 | def add_tab(self, width = 2, **kw): |
| 91 | """Creates a new tab, and returns it's corresponding frame |
| 92 | |
| 93 | """ |
| 94 | |
| 95 | temp = self.tabs #Temp is used so that the value of self.tabs will not throw off the argument sent by the label's event binding |
| 96 | self.tabVars[self.tabs] = [Label(self.BFrame, relief = RIDGE, **kw)] #Create the tab |
| 97 | self.tabVars[self.tabs][0].bind("<Button-1>", lambda Event:self.change_tab(temp)) #Makes the tab "clickable" |
| 98 | self.tabVars[self.tabs][0].pack(side = LEFT, ipady = self.ypad, ipadx = self.xpad) #Packs the tab as far to the left as possible |
| 99 | self.tabVars[self.tabs].append(Frame(self.noteBook, **self.kwargs)) #Create Frame, and append it to the dictionary of tabs |
| 100 | self.tabVars[self.tabs][1].grid(row = 0, column = 0) #Grid the frame ontop of any other already existing frames |
| 101 | self.change_tab(0) #Set focus to the first tab |
| 102 | self.tabs += 1 #Update the tab count |
| 103 | return self.tabVars[temp][1] #Return a frame to be used as a parent to other widgets |
| 104 | |
| 105 | def destroy_tab(self, tab): |
| 106 | """Delete a tab from the notebook, as well as it's corresponding frame |