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

Method focus_on

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

Locate the IDNum of the given tab and use change_tab to give it focus

(self, tab)

Source from the content-addressed store, hash-verified

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
121 change_tab to give it focus
122
123 """
124
125 self.iteratedTabs = 0 #Keep track of the number of loops made
126 for b in self.tabVars.values(): #Iterate through the dictionary of tabs
127 if b[1] == tab: #Find the NumID of the given tab
128 self.change_tab(self.iteratedTabs) #send the tab's NumID to change_tab to set focus, mimicking that of each tab's event bindings
129 break #Job is done, exit the loop
130 self.iteratedTabs += 1 #Add one to the loop count
131
132def demo():
133 def adjustCanvas(someVariable = None):

Callers 1

demoFunction · 0.95

Calls 2

change_tabMethod · 0.95
valuesMethod · 0.45

Tested by

no test coverage detected