MCPcopy Create free account
hub / github.com/ActiveState/code / destroy_tab

Method destroy_tab

recipes/Python/541092_tkNotebook/recipe-541092.py:105–117  ·  view source on GitHub ↗

Delete a tab from the notebook, as well as it's corresponding frame

(self, tab)

Source from the content-addressed store, hash-verified

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
107
108 """
109
110 self.iteratedTabs = 0 #Keep track of the number of loops made
111 for b in self.tabVars.values(): #Iterate through the dictionary of tabs
112 if b[1] == tab: #Find the NumID of the given tab
113 b[0].destroy() #Destroy the tab's frame, along with all child widgets
114 self.tabs -= 1 #Subtract one from the tab count
115 self.deletedTabs.append(self.iteratedTabs) #Apend the NumID of the given tab to the list of deleted tabs
116 break #Job is done, exit the loop
117 self.iteratedTabs += 1 #Add one to the loop count
118
119 def focus_on(self, tab):
120 """Locate the IDNum of the given tab and use

Callers 1

demoFunction · 0.95

Calls 3

valuesMethod · 0.45
destroyMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected