Python GUI Programming Cookbook(PACKT,2015)

所需积分/C币:10 2015-12-17 22:50:24 9.15MB PDF
7
收藏 收藏
举报

Python is a multi-domain, interpreted programming language. It is a widely used general-purpose, high-level programming language. It is often used as a scripting language because of its forgiving syntax and compatibility with a wide variety of different eco-systems. Its flexible syntax enables devel
Python Gul Programming Cookbook Copyright C 2015 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals However, Packt Publishing cannot guarantee the accuracy of this information First published: November 2015 Production reference: 1261115 Published by Packt Publishing Ltd Livery place 35 Livery Street Birmingham B3 2PB, UK SBN9781785283758 www.packtpub.com Credits Author Project Coordinator Burkhard A meier Shweta h. birwatkar Reviewe Proofreader Joy bindroo Safis Editing Peter bouda Joseph Rex Indexer Priya Sar Commissioning Editor Nadeem Bagan Graphics Kirk penha Acquisition Edito Vivek anantharaman Production coordinator Komal Ramchandani Content Development Editor Sumeet sawant Cover work Komal ramchand Technical Editor Pramod Kumavat Copy editor Janbal dharmara About the author Burkhard A. Meier has more than 15 years of professional experience working in the software industry as a software tester and developer, specializing in software test automation development, execution, and analysis. He has a very strong background in sQL relational database administration, the development of stored procedures, and debugging code While experienced in visual Studio. NET C#, Visual Test, TestComplete, and other testing languages(such as C/C++), the main focus of the author over the past two years has been developing test automation written in Python 3 to test the leading edge of FLIr oNE infrared cameras for iPhone and android smart phones as well as handheld tablets Being highly appreciative of art, beauty, and programming, the author developed Guls in C# and Python to streamline everyday test automation tasks, enabling these automated tests to run unattended for weeks, collecting very useful data to be analyzed and automatically plotted into graphs and e-mailed to upper management upon completion of nightly automated test runs His previous jobs include working as a senior test automation engineer and designer for InfoGenesis(now Agilysys), QAD, InTouch Health, and presently, FLIR Systems YoucangetintouchwithhimthroughhisLinkedinaccounthttps://www.linkedin.com pub/ burkhard-meier/57246/296 I would like to thank all truly great artists such as Leonardo da vinci, charles Baudelaire, Edgar Poe, and so many more for bringing the presence of beauty into our human lives. This book is about creating very beautiful GUls written in the Python programming language and it was inspired by these truly great artists I would like to thank all of the great people that made this book possible Without any of you, this book would only exist in my mind. I would like to especially thank all of my editors at Packt Publishing: Vivek, Arwa, Sumeet, Pramod, Nikhil and so many more. I would also like to thank all of the reviewers of the code of this book. without them this book would be harder to read and apply to real-world problems. Last but not least, I like to thank my wife, our daughter, and our parents for the emotional support they provided so successfully during the writing of this book i also like to give thanks to the creator of this very beautiful and powerful programming language that Python truly is. Thank you Guido About the reviewers Joy bindroo holds a bachelor's degree in computer science and engineering. He is currently pursuing his post-graduate studies in the field of information management. He is a creative person and enjoys working on Linux platform and other open source technologies. He enjoyswritingaboutPythonandsharinghisideasandskillsonhiswebsitehttp://www joybindroo. com/. He likes to sketch, write poems, listen to music, and have fun with his friends in his free time I would like to thank my family, teachers and friends for always encouraging and supporting me. I'm most thankful to lord shiva who enables me to achieve greater heights Peter Bouda works as a senior web developer for MAj Digital and is a specialist in full stack JavaScript applications based on Loop Back and Angular s. He develops python Guls for companies and research projects since 2003 and wrote a german book, PyQt und PySide-GUl-und Anwendungsentwicklung mit Python und Qt, on Python GUI development, which was published in 2012. Currently, he is getting crazy with embedded and open hardware platforms and is working on a modular game console based on open hardware Joseph Rex is a full stack developer with a background in computer security. He has worked on Python gUI products and some clI programs to experiment with information security. He came out of security to web development and developed a passion for rails and Java Script MVC frameworks after working on several projects using jQuery. He has been in the web industry for 3 years, building web applications and mobile apps. He has also written articles on security for Info sec Institute and has written some scripts to back them up. he has to his credit several personal experimental projects written in Python www.Packtpub.com Support files, eBooks, discount offers, and more Forsupportfilesanddownloadsrelatedtoyourbookpleasevisitwww.Packtpub.com Did you know that Packt offers e Book versions of every book published, with PDF and ePub filesavailableYoucanupgradetotheebooKversionatwww.Packtpub.comandasaprint book customer, you are entitled to a discount on the e Book copy. Get in touch with us at service@packtpub com for more details Atwww.packtpub.comyoucanalsoreadacollectionoffreetechnicalarticlessignupfor a range of free newsletters and receive exclusive discounts and offers on Packt books and e Book PACKTLIB https://www2.packtpub.com/books/subscription/packtlib Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search access, and read packt's entire library of books Why Subscribe? Fully searchable across every book published by packt Copy and paste, print, and bookmark content k On demand and accessible via a web browser ree Access for Packt account holders IfyouhaveanaccountwithPacktatwww.paCktpub.comyoucanusethistoaccess PacktLib today and view 9 entirely free books Simply use your login credentials for immediate access Table of contents Preface Chapter 1: Creating the GUl Form and Adding widgets Introduction Creating our first Python GUI Preventing the GUI from being resized Adding a label to the GUI form Creating buttons and changlng thelr text property 1124679 Text box widgets Setting the focus to a widget and disabling widgets 11 Combo box widgets 12 Creating a check button with different initial states 14 Using radio button widgets 16 Using scrolled text widgets 18 Adding several widgets in a loop 20 Chapter 2: Layout Management 23 Introduction 23 Arranging several labels within a label frame widget 24 Using padding to add space around widgets 26 How widgets dynamically expand the GUl 28 Aligning the GUI widgets by embedding frames within frames 32 Creating menu bars 36 Creating tabbed widgets 41L Using the grid layout manager 46 Table of contents Chapter 3: Look and Feel customization 49 Introduction 49 Creating message boxes -information, warning, and error 50 How to create independent message boxes 53 How to create the title of a tkinter window form 56 Changing the icon of the main root window Using a spin box control 58 Relief, sunken, and raised appearance of widgets 61 Creating tooltips using Python 63 How to use the canvas widget 67 Chapter 4: Data and classes 69 Introduction 69 How to use stringvar0 69 How to get data from a widget 73 Using module-level global variables 75 How coding in classes can improve the gUI 79 Writing callback functions 85 Creating reusable GUI components 86 Chapter 5: Matplotlib Charts 91 Introduction 91 Creating beautiful charts using Matplotlib 92 Matplotllb -downloading modules using plp 94 Matplotlib- downloading modules with whl extensions 98 Creating our first chart 100 Placing labels on charts 102 How to give the chart a legend 106 Scaling charts 109 Adjusting the scale of charts dynamically 112 Chapter 6: Threads and Networking 117 Introductlon 117 How to create multiple threads 118 Starting a thread 121 Stopping a thread 125 How to use queues 128 Passing queues among different modules 133 Using dialog widgets to copy files to your network 136 Using TCP/IP to communicate via networks 145 Using URLopen to read data from websites 147 Table of contents Chapter 7: Storing Data in Our MySQL Database via Our GUI 153 Introduction 153 Connecting to a MysQL database from Python 154 Configuring the MySQL connection 157 Designing the Python GUI database 161 Using the SQL INSERT command 168 Using the SQL UPDATE command 172 Using the SQL DELETE command 177 Storing and retrieving data from our MysQL database 181 Chapter 8: Internationalization and Testing 87 Introduction 187 Displaying widget text in different languages 188 Changing the entire GUI language all at once 191 Localizing the GU 196 Preparing the GUI for internationalization 201 How to design a GUI in an agile fashion 204 Do we need to test the gui code? 208 Setting debug watches 212 Configuring different debug output levels 216 Creating self-testing code using Python's _main section 220 Creating robust GUls using unit tests 224 How to write unit tests using the eclipse Pydev IDE 229 Chapter 9: Extending our GUl with the wxPython Library 235 Introduction 235 How to install the wXPython library 236 How to create our gUl in WXPython 239 Quickly adding controls using wXPython 244 Trying to embed a main wxPython app in a main tkinter app 251 Trying to embed our tkinter GUI code into wxPython 253 How to use Python to control two different GUI frameworks 256 How to communicate between the two connected guls 260 Chapter 10: Creating Amazing 3D GUls with PyOpenGL and Py GLet 265 Introduction 265 PyOpen GL transforms our GUI 266 Our gul in 3D! 270 Using bitmaps to make our GUI pretty 275 Py GLet transforms our GUI more easily than Pyopen GL 279 Our GUI in amazing colors 283 Creating a slideshow using tkinter 286 II

...展开详情
试读 127P Python GUI Programming Cookbook(PACKT,2015)
立即下载 低至0.43元/次 身份认证VIP会员低至7折
一个资源只可评论一次,评论内容不能少于5个字
lukern 非常好的一本教授python GUI编程的书。
2017-05-09
回复
i_chaoren very good! Thanks
2017-02-25
回复
jfong There is no many books talking about GUI, this one is good.
2016-07-02
回复
liang_zuokui 不错的书,用来学习Python gui不错
2016-03-10
回复
您会向同学/朋友/同事推荐我们的CSDN下载吗?
谢谢参与!您的真实评价是我们改进的动力~
上传资源赚积分or赚钱
最新推荐
Python GUI Programming Cookbook(PACKT,2015) 10积分/C币 立即下载
1/127
Python GUI Programming Cookbook(PACKT,2015)第1页
Python GUI Programming Cookbook(PACKT,2015)第2页
Python GUI Programming Cookbook(PACKT,2015)第3页
Python GUI Programming Cookbook(PACKT,2015)第4页
Python GUI Programming Cookbook(PACKT,2015)第5页
Python GUI Programming Cookbook(PACKT,2015)第6页
Python GUI Programming Cookbook(PACKT,2015)第7页
Python GUI Programming Cookbook(PACKT,2015)第8页
Python GUI Programming Cookbook(PACKT,2015)第9页
Python GUI Programming Cookbook(PACKT,2015)第10页
Python GUI Programming Cookbook(PACKT,2015)第11页
Python GUI Programming Cookbook(PACKT,2015)第12页
Python GUI Programming Cookbook(PACKT,2015)第13页
Python GUI Programming Cookbook(PACKT,2015)第14页
Python GUI Programming Cookbook(PACKT,2015)第15页
Python GUI Programming Cookbook(PACKT,2015)第16页
Python GUI Programming Cookbook(PACKT,2015)第17页
Python GUI Programming Cookbook(PACKT,2015)第18页
Python GUI Programming Cookbook(PACKT,2015)第19页
Python GUI Programming Cookbook(PACKT,2015)第20页

试读结束, 可继续阅读

10积分/C币 立即下载 >