Reputation: 605
I have a tab page with a text box on it and I want to add a scroll bar to it, but it isn't working for me (it is covering the tab name).
Here is my code:
*Look below*
Any help would be appreciated!
Edit:
I am probably being stupid, but now when I switch between tabs the text doesn't change (if I type 'a' and switch between tabs it show up on all of them), and that didn't happen before until I edited the code. Here is my code; let me know if you need more of it:
tabs = {}
tab_bar = {}
...
def doNew(self):
# Create a new tab with the file name and select it
self.nb.select(self.CreateTab())
# Create a new tab
def CreateTab(self, name='Untitled.asm'):
tab_num = len(tabs) # get current tab number
tab_bar_num = len(tab_bar) # get it's frame as well
tab_bar[tab_bar_num] = Frame(self.nb) # create a new frame
scrollbar = Scrollbar(self.root)
scrollbar.pack(side=RIGHT, fill=Y)
tabs[tab_num] = Text(self.root, yscrollcommand=scrollbar.set)
self.nb.add(tab_bar[tab_bar_num], text=name) # add tab
tabs[tab_num].pack(side=LEFT, fill=BOTH)
scrollbar.config(command=tabs[tab_num].yview)
return tab_num
Thanks again.
Upvotes: 2
Views: 1384
Reputation: 386030
The tab should be a frame that is a child of the notebook. Then, the text widget and scrollbar should be in the frame.
Upvotes: 1