[Python-checkins] r65169 - sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py

guilherme.polo python-checkins at python.org
Mon Jul 21 17:18:40 CEST 2008


Author: guilherme.polo
Date: Mon Jul 21 17:18:40 2008
New Revision: 65169
Log:
Updated/added methods to make it compatible with the ttk Notebook
Modified:
 sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py
Modified: sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py	Mon Jul 21 17:18:40 2008
@@ -469,9 +469,27 @@
 
 self._tab_set.set_selected_tab(page_name)
 
- def select(self):
- """Return the name of the currently selected page."""
- return self._current_page
+ # Some methods to make this Notebook compatible with the ttk Notebook
+
+ def select(self, page_id=None):
+ """Return the name of the currently selected page, otherwise
+ selects page_id.
+ 
+ page_id may be an integer or a page name."""
+ if page_id is None:
+ return self._current_page
+ elif isinstance(page_id, int):
+ self.change_page(self._pages_order[page_id])
+ elif isinstance(page_id, str):
+ self.change_page(page_id)
+
+ def index(self, page_name):
+ """Return the index of page_name."""
+ return self._pages_order.index(page_name)
+
+ def tabs(self):
+ """Return a list of page names."""
+ return self._pages_order
 
 if __name__ == '__main__':
 from Tkinter import Tk, Label, Entry, Button


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /