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

Method change_tab

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

Internal Function

(self, IDNum)

Source from the content-addressed store, hash-verified

74 self.noteBook.grid(row = 1, column = 0, columnspan = 27)
75
76 def change_tab(self, IDNum):
77 """Internal Function"""
78
79 for i in (a for a in range(0, len(self.tabVars.keys()))):
80 if not i in self.deletedTabs: #Make sure tab hasen't been deleted
81 if i <> IDNum: #Check to see if the tab is the one that is currently selected
82 self.tabVars[i][1].grid_remove() #Remove the Frame corresponding to each tab that is not selected
83 self.tabVars[i][0]['relief'] = self.inactiverelief #Change the relief of all tabs that are not selected to "Groove"
84 self.tabVars[i][0]['fg'] = self.inactivefg #Set the fg of the tab, showing it is selected, default is black
85 else: #When on the tab that is currently selected...
86 self.tabVars[i][1].grid() #Re-grid the frame that corresponds to the tab
87 self.tabVars[IDNum][0]['relief'] = self.activerelief #Change the relief to "Raised" to show the tab is selected
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&#x27;s corresponding frame

Callers 2

add_tabMethod · 0.95
focus_onMethod · 0.95

Calls 3

rangeFunction · 0.85
keysMethod · 0.45
gridMethod · 0.45

Tested by

no test coverage detected