[Python-checkins] r65727 - sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py

guilherme.polo python-checkins at python.org
Sun Aug 17 00:57:29 CEST 2008


Author: guilherme.polo
Date: Sun Aug 17 00:57:28 2008
New Revision: 65727

Log:
Added a horizontal scrollbar, it seems useful (at least for OutputWindow). Sometime I will make these scrollbars show only when needed.

Modified:
   sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py	Sun Aug 17 00:57:28 2008
@@ -189,6 +189,8 @@
     @property
     def current_page(self):
         """Return the active EditorPage in EditorWindow."""
+        if not self.text_notebook.pages: # no pages available
+            return None
         curr_tab = self.text_notebook.select()
         if not curr_tab:
             return None
@@ -252,6 +254,9 @@
         page = self.text_notebook.add_page(page_title)
 
         vbar = Scrollbar(page.frame, name='vbar')
+        hbar = Scrollbar(page.frame, name='hbar', orient='horizontal')
+        hbar.set(0, 0)
+        vbar.set(0, 0)
         ptype = ptype or EditorPage
         page.editpage = ptype(page.frame, self, title=page_title,
             name='text', padx=5, wrap='none')
@@ -272,8 +277,11 @@
         # pack widgets
         text = page.editpage.text
         vbar['command'] = text.yview
-        vbar.pack(side=RIGHT, fill=Y)
+        hbar['command'] = text.xview
         text['yscrollcommand'] = vbar.set
+        text['xscrollcommand'] = hbar.set
+        vbar.pack(side=RIGHT, fill=Y)
+        hbar.pack(side=BOTTOM, fill=X)
         fontWeight = 'normal'
         if idleConf.GetOption('main', 'EditorPage', 'font-bold', type='bool'):
             fontWeight = 'bold'


More information about the Python-checkins mailing list