- Tkinter GUI Application Development Blueprints(Second Edition)
- Bhaskar Chaudhary
- 260字
- 2021-06-24 18:35:12
Further reading
The source code for the filedialog module can be found within the Tkinter source code in a separate file named filedialog.py. You are encouraged to take a look at its implementation.
If you are feeling adventurous and want to further explore the Text Editor program, I encourage you to have a look at the source code for Python's built-in editor named IDLE, which is written in Tkinter. The source code for IDLE can be found in your local Python library directory in a folder called idlelib. On Linux Mint, this is located at /usr/lib/python3.4/idlelib.
Read the official Python styling guide, which is specified in the PEP8 documentation at https://www.python.org/dev/peps/pep-0008.
If you like, try to implement syntax highlighting of Python code in the text editor. A naive implementation would first involve defining a list of keywords. Then we can bind the <KeyRelease> event to check whether the typed word is one of the keywords. We can then add a custom tag to the word using tag_add. Finally, we can change its color by using code such as textarea.tag_config("the_keyword_tag", foreground="blue").
A slightly advanced idea to read up on and implement is called lazy loading. This is particularly helpful if you want to open a very large file in the text editor. In the present implementation, it may take very long time to open a very large file. In contrast, lazy loading will read only the section of the file that is currently visible in the text editor, thus making the program much more responsive.
- 軟件安全技術(shù)
- 工程軟件開發(fā)技術(shù)基礎(chǔ)
- Linux核心技術(shù)從小白到大牛
- Dependency Injection in .NET Core 2.0
- Learn WebAssembly
- Vue.js 2 Web Development Projects
- 區(qū)塊鏈技術(shù)進(jìn)階與實(shí)戰(zhàn)(第2版)
- R語(yǔ)言數(shù)據(jù)可視化:科技圖表繪制
- Python商務(wù)數(shù)據(jù)分析(微課版)
- Android系統(tǒng)下Java編程詳解
- Elasticsearch Blueprints
- Monitoring Docker
- Microsoft Dynamics GP 2013 Cookbook
- 讓Python遇上Office:從編程入門到自動(dòng)化辦公實(shí)踐
- 你好!Python