Made a remove page function

The remove page function will remove a page from the notebook.
This commit is contained in:
Bryan Schumaker 2010-11-25 23:20:42 -05:00
parent 32ba199d18
commit b861cfd7df
1 changed files with 11 additions and 3 deletions

View File

@ -61,14 +61,22 @@ def init_page(page_name):
child.visible()
body.connect("switch-page", switch_page)
def add_page(text, content):
label = Label(text)
def add_page(name, content):
label = Label(name)
label.set_angle(90)
page = Page(content)
contents[text] = page
contents[name] = page
body.append_page(page, label)
body.set_tab_label_packing(page, True, True, gtk.PACK_START)
def remove_page(name):
page = contents.get(name, None)
if page == None:
return
n = body.page_num(page)
body.remove_page(n)
del contents[name]
def switch_page(notebook, page, pagenum):
cur_num = body.get_current_page()
child = body.get_nth_page(cur_num)