官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 贡嘎县| 革吉县| 洛宁县| 新竹县| 贡山| 潼南县| 宁化县| 廊坊市| 罗定市| 阿拉善左旗| 望奎县| 镇平县| 环江| 修武县| 察雅县| 龙州县| 定南县| 平远县| 荔波县| 南投县| 宁城县| 修武县| 旺苍县| 安康市| 嘉义县| 西和县| 鄄城县| 梧州市| 漳浦县| 云阳县| 隆子县| 西平县| 西峡县| 延安市| 化隆| 闸北区| 文登市| 横山县| 密山市| 哈尔滨市| 谢通门县|