没有合适的资源?快使用搜索试试~ 我知道了~
首页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的基石,这本书都是一个值得投入的时间和精力的资源。"
资源详情
资源推荐
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
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.
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
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.
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页未读,继续阅读
黑樱耀翼
- 粉丝: 0
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Hadoop生态系统与MapReduce详解
- MDS系列三相整流桥模块技术规格与特性
- MFC编程:指针与句柄获取全面解析
- LM06:多模4G高速数据模块,支持GSM至TD-LTE
- 使用Gradle与Nexus构建私有仓库
- JAVA编程规范指南:命名规则与文件样式
- EMC VNX5500 存储系统日常维护指南
- 大数据驱动的互联网用户体验深度管理策略
- 改进型Booth算法:32位浮点阵列乘法器的高速设计与算法比较
- H3CNE网络认证重点知识整理
- Linux环境下MongoDB的详细安装教程
- 压缩文法的等价变换与多余规则删除
- BRMS入门指南:JBOSS安装与基础操作详解
- Win7环境下Android开发环境配置全攻略
- SHT10 C语言程序与LCD1602显示实例及精度校准
- 反垃圾邮件技术:现状与前景
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功