diff options
Diffstat (limited to 'Lib/idlelib/tabbedpages.py')
-rw-r--r-- | Lib/idlelib/tabbedpages.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Lib/idlelib/tabbedpages.py b/Lib/idlelib/tabbedpages.py index 965f9f8..4186fa2 100644 --- a/Lib/idlelib/tabbedpages.py +++ b/Lib/idlelib/tabbedpages.py @@ -285,6 +285,7 @@ class TabSet(Frame): # placed hide it self.tab_set.lower() + class TabbedPageSet(Frame): """A Tkinter tabbed-pane widget. @@ -302,6 +303,7 @@ class TabbedPageSet(Frame): remove_page() methods. """ + class Page(object): """Abstract base class for TabbedPageSet's pages. @@ -467,31 +469,29 @@ class TabbedPageSet(Frame): self._tab_set.set_selected_tab(page_name) -def _tabbed_pages(parent): - # test dialog - root=Tk() - width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - root.geometry("+%d+%d"%(x, y + 175)) - root.title("Test tabbed pages") - tabPage=TabbedPageSet(root, page_names=['Foobar','Baz'], n_rows=0, + +def _tabbed_pages(parent): # htest # + top=Toplevel(parent) + x, y = map(int, parent.geometry().split('+')[1:]) + top.geometry("+%d+%d" % (x, y + 175)) + top.title("Test tabbed pages") + tabPage=TabbedPageSet(top, page_names=['Foobar','Baz'], n_rows=0, expand_tabs=False, ) tabPage.pack(side=TOP, expand=TRUE, fill=BOTH) Label(tabPage.pages['Foobar'].frame, text='Foo', pady=20).pack() Label(tabPage.pages['Foobar'].frame, text='Bar', pady=20).pack() Label(tabPage.pages['Baz'].frame, text='Baz').pack() - entryPgName=Entry(root) - buttonAdd=Button(root, text='Add Page', + entryPgName=Entry(top) + buttonAdd=Button(top, text='Add Page', command=lambda:tabPage.add_page(entryPgName.get())) - buttonRemove=Button(root, text='Remove Page', + buttonRemove=Button(top, text='Remove Page', command=lambda:tabPage.remove_page(entryPgName.get())) - labelPgName=Label(root, text='name of page to add/remove:') + labelPgName=Label(top, text='name of page to add/remove:') buttonAdd.pack(padx=5, pady=5) buttonRemove.pack(padx=5, pady=5) labelPgName.pack(padx=5) entryPgName.pack(padx=5) - root.mainloop() - if __name__ == '__main__': from idlelib.idle_test.htest import run |