33from tkinter import colorchooser , messagebox
44from ast import literal_eval
55
6- version = '0.0.1.5 '
6+ version = '0.0.1.6 '
77
88print ('Starting Fedit' , version )
99print ('Home dir:' , os .path .expanduser ('~' ))
@@ -40,7 +40,7 @@ def load_config_file():
4040 config_file_obj .write (str (data .content , encoding = 'ascii' ))
4141 config_file_obj .close ()
4242 load_config_file ()
43- print (config )
43+ themes = literal_eval (config [ 'Themes' ] )
4444
4545## Main text editor
4646frame_maintextedit = tk .Frame (root )
@@ -63,15 +63,27 @@ def load_config_file():
6363## Main text editor
6464widget_maintextedit .pack (expand = 1 , fill = 'both' )
6565
66+ ## LabelBar
67+ frame_labelbar = tk .Frame (root )
68+ labelbar = tktools .LabelBar (frame_labelbar )
69+
70+ labelbar .add_label ('chars' , '0' )
71+ labelbar .grid_label ('chars' , row = 0 )
72+ labelbar .config_label ('chars' , bg = themes [False ]['buttons' ], fg = themes [False ]['buttons_text' ])
73+
74+ def update_labelbar_chars (* args , ** kwargs ):
75+ labelbar .config_label ('chars' , text = str (len (widget_maintextedit .widget_raw ().get (0.0 , 'end' ))- 1 ))
76+ widget_maintextedit .widget_raw ().bind ('<Any-KeyRelease>' , update_labelbar_chars )
77+
6678## Theme
6779theme_current = False #False=Light True=Dark
68- themes = literal_eval (config ['Themes' ])
6980
7081def update_theme (theme , text_theme , button_theme , button_text_theme , custom = 0 ):
7182 print ('Custom:' , custom , 'BG:' , theme , 'FG:' , text_theme )
7283 root .config (bg = theme )
7384 widget_maintextedit .config (bg = theme , fg = text_theme , insertbackground = text_theme )
7485 frame_menubar .config (bg = theme )
86+ frame_labelbar .config (bg = theme )
7587 for button in menubar .buttons :
7688 menubar .buttons [button ]['raw' ].config (bg = button_theme , fg = button_text_theme )
7789
@@ -124,6 +136,7 @@ def changing_theme_func():
124136## Packing
125137frame_menubar .pack (side = 'top' , expand = 1 , fill = 'both' )
126138frame_maintextedit .pack (expand = 1 , fill = 'both' )
139+ frame_labelbar .pack (side = 'bottom' , expand = 1 , fill = 'both' )
127140
128141## Complete exit
129142def complete_exit ():
0 commit comments