python27中文文档_学习Python 新去处:Python 官方中文文档

Python 作为世界上最好用的语言,官方支持的文档一直没有中文。小伙伴们已经习惯了原汁原味的英文文档,但如果有官方中文文档,那么查阅或理解速度都会大大提升。本文将介绍隐藏在 Python 官网的中文文档~

以前也是有一些第三方维护的 Python 中文文档,不过可能因为人力等限制,并做不到同步更新与维护。目前也有很多高质量的 Python 中文资源,但大部分都是大牛写的书或教程,官方文档的翻译并得不到保证。

最近很多开发者发现 Python现在已经有官方中文文档了,但直接从 Python 文档界面并看不到。如下在 Python 文档中,只有英语、法语、日语和韩语可选,我们并看不到中文选项。

但是如果我们在地址栏中手动键入 zh-cn,即:https://docs.python.org/zh-cn,那么我们就能看到官方的中文文档了。如下,我们现在从下拉项也可以直接看到中文选项。因为 Python/C API 接口等高阶内容还是英文,所以很可能目前中文文档还在完善中,并没有完全开放。

官方中文文档有什么

目前,官方中文文档已经有 3.8.0a2、3.7.3、3.6.8、2.7.16 几个主流版本的资料,相比英文文档只缺少 3.5.7。对于每一个 Python 版本,文档都包含很多内容,其中入门教程与语言参考已经完成汉化,其它基础内容也都有中文译文,例如各版本的新变化、安装和分发 Python 模块、常见问题等等。

但是还有一些高阶主题基本都保留了英文,例如 Python/C API 接口、标准库参考、扩展和嵌入等。这些内容有的比较难懂,也许它们对译者的要求更高,完成的进度也慢一些。

对于初学者而言,入门教程和 Python 语言参考可能是大家最需要的。其中入门教程非正式地介绍了 Python 语言的基本概念和功能。读者最好在阅读时准备一个 Python 解释器进行练习,不过所有的例子都是相互独立的,所以这个教程也可以离线阅读。

Python 语言参考相比入门教程提供了更正式的语法和「核心语义」,这一份参考非常简洁,它希望保证知识点的准确和完整。除了前面这两份基本学习资料,英文版 Python 文档还为 C/C++提供了两个额外的手册,不过这些高阶内容暂时还没有中文。

最后,Python 中文文档还有个小彩蛋,它把 Python 中的术语都翻了一遍。很多时候,这些术语都有不同的译文与表达方式,例如 decorator 既可以保留原文,也可以翻成装饰器或修饰器。也许以后,这一份官方词汇表可以帮助我们找到更合适的表达方式。

中文文档怎么搜

可能对大多数开发者而言,检索 Python 的函数或用法是文档的常用方法。例如如果我们希望找到函数式编程的使用方法,那么可以在中文文档中搜索 Lambda:

其中流程控制工具有匿名函数 Lambda 的使用简介,而重要的函数式编程指引暂时只有一小部分完成翻译。如下展示的是检索到的 Lambda 使用指南。

Abstract Describes the Tkinter widget set for constructing graphical user interfaces (GUIs) in the Python programming language. This publication is available in Web form1 and also as a PDF document2. Please forward any comments to tcc-doc@nmt.edu. Table of Contents 1. What is Tkinter?.......................................................................................................................3 2. A minimal application..............................................................................................................3 3. Definitions..............................................................................................................................4 4. Layout management.................................................................................................................5 4.1. The .grid() method....................................................................................................5 4.2. Other grid management methods...................................................................................6 4.3. Configuring column and row sizes.................................................................................7 4.4. Making the root window resizeable................................................................................8 5. Standard attributes...................................................................................................................8 5.1. Dimensions...................................................................................................................9 5.2. The coordinate system...................................................................................................9 5.3. Colors...........................................................................................................................9 5.4. Type fonts...................................................................................................................10 5.5. Anchors......................................................................................................................11 5.6. Relief styles.................................................................................................................12 5.7. Bitmaps.......................................................................................................................12 5.8. Cursors.......................................................................................................................12 5.9. Images........................................................................................................................14 5.10. Geometry strings........................................................................................................14 5.11. Window names...........................................................................................................15 5.12. Cap and join styles.....................................................................................................15 5.13. Dash patterns.............................................................................................................16 5.14. Matching stipple patterns............................................................................................16 6. The Button widget................................................................................................................17 7. The Canvas widget................................................................................................................19 7.1. Canvas coordinates......................................................................................................20 7.2. The Canvas display list................................................................................................20 7.3. Canvas object IDs........................................................................................................21 7.4. Canvas tags................................................................................................................21 1http://www.nmt.edu/tcc/help/pubs/tkinter/ 2http://www.nmt.edu/tcc/help/pubs/tkinter/tkinter.pdf 1 Tkinter reference New Mexico Tech Computer Center 7.5. CanvastagOrId arguments......................................................................................21 7.6. Methods on Canvas widgets........................................................................................21 7.7. Canvas arc objects.......................................................................................................26 7.8. Canvas bitmap objects.................................................................................................28 7.9. Canvas image objects..................................................................................................29 7.10. Canvas line objects.....................................................................................................29 7.11. Canvas oval objects....................................................................................................31 7.12. Canvas polygon objects..............................................................................................32 7.13. Canvas rectangle objects.............................................................................................34 7.14. Canvas text objects.....................................................................................................35 7.15. Canvas window objects..............................................................................................36 8. The Checkbutton widget......................................................................................................37 9. The Entry widget..................................................................................................................40 9.1. Scrolling an Entry widget............................................................................................43 10. The Frame widget................................................................................................................43 11. The Label widget................................................................................................................44 12. The LabelFrame widget......................................................................................................46 13. The Listbox widget............................................................................................................48 13.1. Scrolling a Listbox widget........................................................................................52 14. The Menu widget..................................................................................................................52 14.1. Menu item creation (coption) options.........................................................................55 14.2. Top-level menus.........................................................................................................56 15. The Menubutton widget......................................................................................................57 16. The Message widget............................................................................................................59 17. The OptionMenu widget.......................................................................................................60 18. The PanedWindow widget....................................................................................................61 18.1. PanedWindow child configuration options...................................................................63 19. The Radiobutton widget....................................................................................................64 20. The Scale widget................................................................................................................67 21. The Scrollbar widget........................................................................................................70 21.1. The Scrollbarcommand callback............................................................................72 21.2. Connecting a Scrollbar to another widget................................................................73 22. The Spinbox widget............................................................................................................73 23. The Text widget..................................................................................................................78 23.1. Text widget indices...................................................................................................80 23.2. Text widget marks....................................................................................................81 23.3. Text widget images...................................................................................................82 23.4. Text widget windows...............................................................................................82 23.5. Text widget tags.......................................................................................................82 23.6. Setting tabs in a Text widget......................................................................................83 23.7. The Text widget undo/redo stack..............................................................................83 23.8. Methods on Text widgets..........................................................................................84 24. Toplevel: Top-level window methods..................................................................................91 25. Universal widget methods.....................................................................................................93 26. Standardizing appearance...................................................................................................101 26.1. How to name a widget class......................................................................................102 26.2. How to name a widget instance.................................................................................102 26.3. Resource specification lines.......................................................................................102 26.4. Rules for resource matching......................................................................................103 27. Connecting your application logic to the widgets...................................................................104 28. Control variables: the values behind the widgets...................................................................104 29. Focus: routing keyboard input.............................................................................................106 New Mexico Tech Computer Center Tkinter reference 2 30. Events................................................................................................................................107 30.1. Levels of binding......................................................................................................108 30.2. Event sequences.......................................................................................................109 30.3. Event types..............................................................................................................109 30.4. Event modifiers........................................................................................................110 30.5. Key names...............................................................................................................111 30.6. Writing your handler: The Event class......................................................................113 30.7. The extra arguments trick..........................................................................................115 30.8. Virtual events...........................................................................................................116 31. Pop-up dialogs....................................................................................................................116 31.1. The tkMessageBox dialogs module..........................................................................116 31.2. The tkFileDialog module.....................................................................................118 31.3. The tkColorChooser module.................................................................................119
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值