实例介绍
【实例简介】Python GUI编程经典书籍
【实例截图】
【核心代码】
Chapter 1: Creating the GUI Form and Adding Widgets 1
Introduction 1
Creating our first Python GUI 2
Preventing the GUI from being resized 4
Adding a label to the GUI form 6
Creating buttons and changing their text property 7
Text box widgets 9
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 GUI 28
Aligning the GUI widgets by embedding frames within frames 32
Creating menu bars 36
Creating tabbed widgets 41
Using the grid layout manager 4
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 57
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 StringVar() 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
Matplotlib – downloading modules using pip 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
Introduction 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
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 187
Introduction 187
Displaying widget text in different languages 188
Changing the entire GUI language all at once 191
Localizing the GUI 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 GUIs using unit tests 224
How to write unit tests using the Eclipse PyDev IDE 229
Chapter 9: Extending Our GUI with the wxPython Library 235
Introduction 235
How to install the wxPython library 236
How to create our GUI 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 GUIs 260
Chapter 10: Creating Amazing 3D GUIs with PyOpenGL and PyGLet 265
Introduction 265
PyOpenGL transforms our GUI 266
Our GUI in 3D! 270
Using bitmaps to make our GUI pretty 275
PyGLet transforms our GUI more easily than PyOpenGL 279
Our GUI in amazing colors 283
Creating a slideshow using tkinter 286
标签: python
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论