Skip to content

Commit

Permalink
modify
Browse files Browse the repository at this point in the history
  • Loading branch information
arcticfox1919 committed Apr 18, 2019
1 parent 7939923 commit 8a883c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# tkinter-practice
tkinter实战项目
# tkinter 实战项目

## 自制文本编辑器

![Editor](https://github.com/arcticfox1919/ImageHosting/blob/master/Snipaste_2019-04-18_21-30-18.jpg?raw=true)

[源码](https://github.com/arcticfox1919/tkinter-practice/tree/master/editor)

6 changes: 3 additions & 3 deletions editor/editor.py → editor/editor.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _create_menu_bar_(self):

# 创建快捷菜单栏
def _create_shortcut_bar_(self):
shortcut_bar = Frame(self, height=25, background='light sea green')
shortcut_bar = Frame(self, height=25, background='#20b2aa')
shortcut_bar.pack(fill='x')

for i, icon in enumerate(ICONS):
Expand All @@ -102,7 +102,7 @@ def _create_shortcut_bar_(self):
def _create_body_(self):
# 创建行号栏 (takefocus=0 屏蔽焦点)
self.line_number_bar = Text(self, width=4, padx=3, takefocus=0, border=0,
background='khaki', state='disabled')
background='#F0E68C', state='disabled')
self.line_number_bar.pack(side='left', fill='y')
# 创建文本输入框(undo是否启用撤销机制)
self.content_text = Text(self, wrap='word', undo=True)
Expand All @@ -119,7 +119,7 @@ def _create_body_(self):
self.content_text.bind('<Control-F>', self.find_text)
self.content_text.bind('<Any-KeyPress>', lambda e: self._update_line_num())
self.bind_all('<KeyPress-F1>', lambda e: self.show_messagebox("帮助"))
self.content_text.tag_configure('active_line', background='ivory2')
self.content_text.tag_configure('active_line', background='#EEEEE0')

# 创建滚动条
scroll_bar = Scrollbar(self.content_text)
Expand Down

0 comments on commit 8a883c7

Please sign in to comment.