没有合适的资源?快使用搜索试试~ 我知道了~
首页2000年John Grayson著作:Python与Tkinter图形界面编程指南
"《Python与Tkinter编程》是由John E. Grayson所著的一本专业书籍,由Manning出版社于2000年发行。这本书是针对Python语言的图形用户界面(GUI)编程指南,主要讲解如何利用Tkinter模块来创建交互式程序。Tkinter是Python标准库的一部分,为Python开发者提供了构建简单到复杂图形界面的工具,尤其适合初学者入门或进阶学习。 书中详细介绍了如何设计和实现GUI元素,如按钮、文本框、菜单、对话框等,以及如何组织布局和事件处理。它不仅涵盖基础概念,还包括了一些高级主题,如控件定制、图像处理、多窗口和多线程应用的设计。作者John Grayson以其清晰且易于理解的风格,确保了读者能够逐步掌握Tkinter的使用,并将其应用于实际项目中。 本书定位在为Python用户提供实用的GUI编程技巧,特别适合那些希望扩展Python功能并创建桌面应用程序的开发者。由于其出版时间早,尽管可能会有些许过时的API细节,但它依然是理解和学习Tkinter的经典参考书籍。此外,Manning出版社还提供了在线购买和订购渠道,以及针对批量购买的折扣信息。版权方面,所有内容受法律保护,未经许可不得复制或传播。 对于那些希望通过Python和Tkinter探索GUI世界的专业人士,这本书是一份不可多得的参考资料,它不仅教你如何编写代码,更会引导你理解和欣赏GUI设计的艺术。无论你是想提升编程技能,还是寻找一份深入理解Tkinter的基石,这本书都是一个值得投入的时间和精力的资源。"
资源详情
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/10951300/bg10.jpg)
xv
preface
I first encountered Python in 1993 when I joined a small company in Rhode Island. Their pri-
mary product was a GUI-builder for X/Motif that generated code for C, C++, Ada and Python. I
was tasked with extending the object-oriented interface for X/Motif and Python. In the past I’d
become skeptical about the use of interpretive languages, so I began the task with little excite-
ment. Two days later I was hooked. It was easy to develop interfaces that would have taken much
more time and code to develop in C. Soon after, I began to choose interfaces developed using the
Python interface in preference to compiled C code.
After I left the company in Rhode Island, I began to develop applications using Tkinter,
which had become the preeminent GUI for Python. I persuaded one company, where I was
working on contract, to use Python to build a code-generator to help complete a huge project
that was in danger of overrunning time and budget. The project was a success. Four years later
there are many Python programmers in that company and some projects now use Tkinter and
Python for a considerable part of their code.
It was this experience, though, that led me to start writing this book. Very little documenta-
tion was available for Tkinter in the early days. The Tkinter Life Preserver was the first document
that helped people pull basic information together. In 1997 Fredrik Lundh released some excel-
lent documentation for the widget classes on the web, and this has served Tkinter programmers
well in the past couple of years. One of the problems that I saw was that although there were sev-
eral example programs available (the Python distribution contains several), they were mostly brief
in content and did not represent a framework for a full application written with Tkinter. Of
course, it is easy to connect bits of code together to make it do more but when the underlying
architecture relies on an interpreter it is easy to produce an inferior product, in terms of execu-
tion speed, aesthetics, maintainability and extensibility.
So, one of the first questions that I was asked about writing Tkinter was “How do I make an
XXX?” I’d usually hand the person a chunk of code that I’d written and, like most professional
programmers, they would work out the details. I believe strongly that learning from full, working
examples is an excellent way of learning how to program in a particular language and to achieve
particular goals.
When I was training in karate, we frequently traveled to the world headquarters of Shuko-
kai, in New Jersey, to train with the late Sensei Shigeru Kimura. Sensei Kimura often told us “I
![](https://csdnimg.cn/release/download_crawler_static/10951300/bg11.jpg)
xvi PREFACE
can’t teach you how to do this (a particular technique)—you have to steal it.” My approach to
learning Tkinter is similar. If someone in the community has solved a problem, we need to steal
it from them. Now, I am not suggesting that we infringe copyright and professional practice! I
simply mean you should learn from whatever material is available. I hope that you will use the
examples in the book as a starting point for your own creations. In a small number of cases I have
used code or the ideas of other programmers. If this is the case I have given the original author an
appropriate acknowledgment. If you use one of these pieces of code, I’d appreciate it if you would
also acknowledge the original author. After all, what we “steal” has more value than what we pro-
duce ourselves—it came from the Sensei!
I was impressed by the format of Douglas A. Young’s The X Window System: Programming
and Applications with Xt. It is a little old now, but it had a high proportion of complete code
examples, some of which made excellent templates upon which new applications could be built.
Python and Tkinter Programming has some parallels in its layout. You will find much longer
examples than you may be accustomed to in other programming books. I hope that many of the
examples will be useful either as templates or as a source of inspiration for programmers who
have to solve a particular problem.
One side effect of presenting complete examples as opposed to providing code fragments is
that you will learn a great deal about my style of programming. During the extensive reviews for
Python and Tkinter Programming some of the reviewers suggested alternate coding patterns for
some of the examples. Wherever possible, I incorporated their suggestions, so that the examples
now contain the programming styles of several people. I expect that you will make similar
improvements when you come to implement your own solutions.
I hope that you find Python and Tkinter Programming useful. If it saves you even a couple of
hours when you have an application to write, then it will have been worth the time spent reading
the book.
![](https://csdnimg.cn/release/download_crawler_static/10951300/bg12.jpg)
xvii
special thanks
Writing Python and Tkinter Programming has been the collective effort of many people. Each of
these persons contributed their time, expertise and effort to help make the book more effective.
Many of the words are theirs and not mine—the book is now better.
I want to thank the team of technical reviewers: Fred L. Drake, Robin Friedrich, Alan
Gauld, Bob Gibson, Lynn Grande, Doug Hellmann, Garrett G. Hodgson, Paul Kendrew,
Andrew M. Kuchling, Cameron Laird, Gregory A. Landrum, Ivan Van Laningham, Burt Leaven-
worth, Ken McDonald, Frank McGeough, Robert Meegan, William Peloquin, Robert J. Roberts
and Guido van Rossum. They provided detailed comments that resulted in significant improve-
ments to the book’s content, focus and accuracy.
Some of the code examples were derived from code written by others. I want to thank these
authors for agreeing to allow me to use their code in this book.
Doug Hellman wrote an excellent module for Pmw, GUIAppD.py, which I adapted as App-
Shell.py and used for many examples within the book. Doug agreed that I could use the code. If
you find AppShell.py useful in your applications, please acknowledge the original author of this
work.
Konrad Hinsen wrote TkPlotCanvas.py, which was intended to be used with NumPy,
which uses extension modules optimized for numerical operations. I adapted it to run without
NumPy and also added some additional graphical capabilities. Again, if you find it useful, please
acknowledge Konrad Hinsen.
The Tree and Node classes used in chapter 8 are derived from code released by OpenChem
for inclusion within their Open Source project. You might want to look at any future releases
from this organization, since the tree-widget examples presented in this book are limited in their
capability.
Appendix B uses the man pages for Tk as a starting point for documenting Tkinter. The
copyright owners, the Regents of the University of California and Sun Microsystems allow deriv-
ative works to be made, provided that the original copyright is acknowledged.
I also want to thank Gordon Smith at General Dynamics for having confidence in the use
of Python and Tkinter in some of the projects for which he was responsible; observing their use
in real-world applications is one of the factors that prompted me to begin the task of writing the
![](https://csdnimg.cn/release/download_crawler_static/10951300/bg13.jpg)
xviii SPECIAL THANKS
book. I was able to test some of the draft chapters by giving them to his staff and intern students
to solve some of their programming tasks.
Next, I want to thank everyone at Manning Publications who turned my ideas into a book.
I had many long conversations with the publisher, Marjan Bace, who led me through the some-
what complex task of writing a book that is going to be useful to its readers. Ted Kennedy coor-
dinated the review process which produced much constructive criticism. Mary Piergies took care
of the production of the book with Kristen Black, the copyeditor, and Dottie Marsico, the type-
setter, who took my crude attempts to use FrameMaker and gave the book the professional edge
it needed. Doug Hellman did a fine technical edit and corrected many code problems found in
the final typeset copy.
Finally, I’d like to thank my wife, Allison, and my children, Nina, Chris, Jeff and Alana, for
understanding that it wasn’t so much losing a spouse and father but gaining an author.
![](https://csdnimg.cn/release/download_crawler_static/10951300/bg14.jpg)
xix
about the reader
Python and Tkinter Programming is intended for programmers who already know Python or who
are learning Python (perhaps using Manning’s Quick Python as their guide) who wish to add
graphical user interfaces (GUIs) to their applications. Because Python and Tkinter Programming
presents many fully functional examples with lots of code annotations, experienced programmers
without Python expertise will find the book helpful in using Python and Tkinter to solve imme-
diate problems.
The book may also be used by Tcl/Tk script programmers as a guide to converting from
Tcl/Tk to Python and Tkinter. However, I do not intend to get into a philosophical discussion
about whether that would be a proper thing to do—I’m biased!
剩余683页未读,继续阅读
![azw3](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://profile-avatar.csdnimg.cn/4754199d9304417ba70962f962f449df_blackswing.jpg!1)
黑樱耀翼
- 粉丝: 0
- 资源: 8
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![](https://csdnimg.cn/release/wenkucmsfe/public/img/voice.245cc511.png)
最新资源
- 岩石滑动与断层冲击地压:声发射特征分析
- 新时代煤炭工业八大战略新取向剖析
- 开采强度对华亭矿区冲击地压危险性的影响分析
- 新安煤矿探采对比:影响安全生产的关键因素与技术支撑
- 210MW循环流化床锅炉引风机变频改造优化与节能效果
- 浅埋煤层开采沉陷预测:方法应用与影响分析
- 优化巷道过陷落柱支护方案:数值模拟与现场试验
- 坚硬顶板定向断裂爆破技术:安全高效采煤新方案
- 北航2019算法课作业解析:投资策略与凸子多边形优化
- 断层破碎带垮冒下堆积体边界抗力分布关键影响因素
- 哈拉沟选煤厂优化末煤系统提高效率与处理能力
- 瓦斯涌出影响下采动煤体蠕变失稳研究
- 提升煤矿装载效率的可控箕斗定量装载设备设计
- 水分调控下烟煤瓦斯吸附特性对比研究
- 重介质悬浮液密度控制硬件设计与选型探讨
- 坚硬顶板巷道支护参数设计:现场测试与数值分析
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![](https://csdnimg.cn/release/wenkucmsfe/public/img/green-success.6a4acb44.png)