我有一个带有文本框的标签页,我想为其添加一个滚动条,但它对我不起作用(它覆盖了标签名称)。
这是我的代码:
*Look below*
如有任何帮助,我们将不胜感激!
编辑:
我可能是愚蠢的,但现在当我在选项卡之间切换时,文本不会改变(如果我键入“a”并在选项卡之间切换,它会显示在所有选项卡上),并且之前没有发生,直到我编辑了代码。这是我的代码;如果您需要更多,请告诉我:
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
再次感谢。
请您参考如下方法:
选项卡应该是笔记本的子框架。然后,文本小部件和滚动条应该在框架中。
