1515 TOP , BOTTOM , RIGHT , LEFT , SOLID , GROOVE , NORMAL , DISABLED ,
1616 NONE , BOTH , X , Y , W , E , EW , NS , NSEW , NW ,
1717 HORIZONTAL , VERTICAL , ANCHOR , ACTIVE , END )
18- from tkinter .ttk import Scrollbar
18+ from tkinter .ttk import Notebook , Scrollbar
1919import tkinter .colorchooser as tkColorChooser
2020import tkinter .font as tkFont
2121import tkinter .messagebox as tkMessageBox
@@ -101,15 +101,19 @@ def create_widgets(self):
101101 load_configs: Load pages except for extensions.
102102 activate_config_changes: Tell editors to reload.
103103 """
104- self .tab_pages = TabbedPageSet (self ,
105- page_names = ['Fonts/Tabs' , 'Highlighting' , 'Keys' , 'General' ,
106- 'Extensions' ])
107- self .tab_pages .pack (side = TOP , expand = TRUE , fill = BOTH )
108- self .create_page_font_tab ()
109- self .create_page_highlight ()
110- self .create_page_keys ()
111- self .create_page_general ()
112- self .create_page_extensions ()
104+ self .note = note = Notebook (self , width = 450 , height = 450 )
105+ fontpage = self .create_page_font_tab ()
106+ highpage = self .create_page_highlight ()
107+ keyspage = self .create_page_keys ()
108+ genpage = self .create_page_general ()
109+ extpage = self .create_page_extensions ()
110+ note .add (fontpage , text = 'Fonts/Tabs' )
111+ note .add (highpage , text = 'Highlights' )
112+ note .add (keyspage , text = ' Keys ' )
113+ note .add (genpage , text = ' General ' )
114+ note .add (extpage , text = 'Extensions' )
115+ note .enable_traversal ()
116+ note .pack (side = TOP , expand = TRUE , fill = BOTH )
113117 self .create_action_buttons ().pack (side = BOTTOM )
114118
115119 def load_configs (self ):
@@ -270,7 +274,7 @@ def create_page_font_tab(self):
270274
271275 # Create widgets:
272276 # body and body section frames.
273- frame = self .tab_pages . pages [ 'Fonts/Tabs' ]. frame
277+ frame = Frame ( self .note )
274278 frame_font = LabelFrame (
275279 frame , borderwidth = 2 , relief = GROOVE , text = ' Base Editor Font ' )
276280 frame_indent = LabelFrame (
@@ -281,7 +285,7 @@ def create_page_font_tab(self):
281285 font_name_title = Label (
282286 frame_font_name , justify = LEFT , text = 'Font Face :' )
283287 self .fontlist = Listbox (frame_font_name , height = 5 ,
284- takefocus = FALSE , exportselection = FALSE )
288+ takefocus = True , exportselection = FALSE )
285289 self .fontlist .bind ('<ButtonRelease-1>' , self .on_fontlist_select )
286290 self .fontlist .bind ('<KeyRelease-Up>' , self .on_fontlist_select )
287291 self .fontlist .bind ('<KeyRelease-Down>' , self .on_fontlist_select )
@@ -297,7 +301,7 @@ def create_page_font_tab(self):
297301 temp_font = tkFont .Font (parent , ('courier' , 10 , 'normal' ))
298302 self .font_sample = Label (
299303 frame_font_sample , justify = LEFT , font = temp_font ,
300- text = 'AaBbCcDdEe\n FfGgHhIiJjK \n 1234567890\n #:+=(){}[]' )
304+ text = 'AaBbCcDdEe\n FfGgHhIiJj \n 1234567890\n #:+=(){}[]' )
301305 # frame_indent.
302306 indent_title = Label (
303307 frame_indent , justify = LEFT ,
@@ -493,23 +497,22 @@ def create_page_highlight(self):
493497 self .highlight_target = tracers .add (
494498 StringVar (parent ), self .var_changed_highlight_target )
495499
496- ##widget creation
497- #body frame
498- frame = self .tab_pages .pages ['Highlighting' ].frame
499- #body section frames
500+ # Widget creation:
501+ # body frame and section frames
502+ frame = Frame (self .note )
500503 frame_custom = LabelFrame (frame , borderwidth = 2 , relief = GROOVE ,
501504 text = ' Custom Highlighting ' )
502505 frame_theme = LabelFrame (frame , borderwidth = 2 , relief = GROOVE ,
503506 text = ' Highlighting Theme ' )
504507 #frame_custom
505508 self .highlight_sample = Text (
506509 frame_custom , relief = SOLID , borderwidth = 1 ,
507- font = ('courier' , 12 , '' ), cursor = 'hand2' , width = 21 , height = 11 ,
510+ font = ('courier' , 12 , '' ), cursor = 'hand2' , width = 21 , height = 13 ,
508511 takefocus = FALSE , highlightthickness = 0 , wrap = NONE )
509512 text = self .highlight_sample
510513 text .bind ('<Double-Button-1>' , lambda e : 'break' )
511514 text .bind ('<B1-Motion>' , lambda e : 'break' )
512- text_and_tags = (
515+ text_and_tags = (( ' \n ' , 'normal' ),
513516 ('#you can click here' , 'comment' ), ('\n ' , 'normal' ),
514517 ('#to choose items' , 'comment' ), ('\n ' , 'normal' ),
515518 ('def' , 'keyword' ), (' ' , 'normal' ),
@@ -525,7 +528,7 @@ def create_page_highlight(self):
525528 ('cursor |' , 'cursor' ), ('\n ' , 'normal' ),
526529 ('shell' , 'console' ), (' ' , 'normal' ),
527530 ('stdout' , 'stdout' ), (' ' , 'normal' ),
528- ('stderr' , 'stderr' ), ('\n ' , 'normal' ))
531+ ('stderr' , 'stderr' ), ('\n \n ' , 'normal' ))
529532 for texttag in text_and_tags :
530533 text .insert (END , texttag [0 ], texttag [1 ])
531534 for element in self .theme_elements :
@@ -1039,10 +1042,9 @@ def create_page_keys(self):
10391042 self .keybinding = tracers .add (
10401043 StringVar (parent ), self .var_changed_keybinding )
10411044
1042- ##widget creation
1043- #body frame
1044- frame = self .tab_pages .pages ['Keys' ].frame
1045- #body section frames
1045+ # Widget creation:
1046+ # body and section frames.
1047+ frame = Frame (self .note )
10461048 frame_custom = LabelFrame (
10471049 frame , borderwidth = 2 , relief = GROOVE ,
10481050 text = ' Custom Key Bindings ' )
@@ -1449,9 +1451,8 @@ def create_page_general(self):
14491451 StringVar (parent ), ('main' , 'EditorWindow' , 'height' ))
14501452
14511453 # Create widgets:
1452- # body.
1453- frame = self .tab_pages .pages ['General' ].frame
1454- # body section frames.
1454+ # body and section frames.
1455+ frame = Frame (self .note )
14551456 frame_run = LabelFrame (frame , borderwidth = 2 , relief = GROOVE ,
14561457 text = ' Startup Preferences ' )
14571458 frame_save = LabelFrame (frame , borderwidth = 2 , relief = GROOVE ,
@@ -1488,7 +1489,7 @@ def create_page_general(self):
14881489 frame_helplist = Frame (frame_help )
14891490 frame_helplist_buttons = Frame (frame_helplist )
14901491 self .helplist = Listbox (
1491- frame_helplist , height = 5 , takefocus = FALSE ,
1492+ frame_helplist , height = 5 , takefocus = True ,
14921493 exportselection = FALSE )
14931494 scroll_helplist = Scrollbar (frame_helplist )
14941495 scroll_helplist ['command' ] = self .helplist .yview
@@ -1669,7 +1670,7 @@ def create_page_extensions(self):
16691670 save_all_changed_extensions: Call extension page Save().
16701671 """
16711672 parent = self .parent
1672- frame = self .tab_pages . pages [ 'Extensions' ]. frame
1673+ frame = Frame ( self .note )
16731674 self .ext_defaultCfg = idleConf .defaultCfg ['extensions' ]
16741675 self .ext_userCfg = idleConf .userCfg ['extensions' ]
16751676 self .is_int = self .register (is_int )
@@ -1704,6 +1705,8 @@ def create_page_extensions(self):
17041705 self .extension_list .selection_set (0 )
17051706 self .extension_selected (None )
17061707
1708+ return frame
1709+
17071710 def load_extensions (self ):
17081711 "Fill self.extensions with data from the default and user configs."
17091712 self .extensions = {}
0 commit comments