在Windows下使用shutil时书籍《Python GUI Programming Cookbook Second Edition》中代码错误及修正

问题描述

在读书籍《Python GUI Programming Cookbook Second Edition》的184页时,有一个利用open file dialog选中文件并复制文件的例子。但我运行该程序时始终无法成功复制文件。我使用的是Anaconda3的Python 3.6.3、Windows7系统运行环境。

解决方法

将书上相关错误代码改正,同时在目标文件夹地址栏输入完整地址即可。以下代码注释掉部分是书本上错误代码:

#netDir = fDir + '\\Backup' 
netDir = fDir + '/Backup' 
#dst = self.netwEntry.get() + '\\'+ file
dst = self.netwEntry.get() + '/'+ file

成功运行后的界面效果如图:
成功运行效果图

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Python GUI Programming Cookbook Second Edition 包含PDF和epub文件 Book Name : Python GUI Programming Cookbook Edition : 2nd Edition | | ISBN : B01N7IOL6S Author Name : Burkhard A Meier; Category : Programming & IT Format / Pages : PDF - 422 Pages Python GUI Programming Cookbook 2nd Edition pdf Key Features Use object-oriented programming to develop amazing GUIs in Python Create a working GUI project as a central resource for developing your Python GUIs Easy-to-follow recipes to help you develop code using the latest released version of Python Book Description 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. Python GUI Programming Cookbook follows a task-based approach to help you create beautiful and very effective GUIs with the least amount of code necessary. This book will guide you through the very basics of creating a fully functional GUI in Python with only a few lines of code. Each and every recipe adds more widgets to the GUIs we are creating. While the cookbook recipes all stand on their own, there is a common theme running through all of them. As our GUIs keep expanding, using more and more widgets, we start to talk to networks, databases, and graphical libraries that greatly enhance our GUI's functionality. This book is what you need to expand your knowledge on the subject of GUIs, and make sure you're not missing out in the long run. What you will learn Create the GUI Form and add widgets Arrange the widgets using layout managers Use object-oriented programming to create GUIs Create Matplotlib charts Use threads and talking to networks Talk to a MySQL database via the GUI Perform unit-testing and internationalizing the GUI Extend the GUI with third-party graphical libraries Get to know the best practices to create GUIs About the Author Burkhard A. Meier has more than 17 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 Python 3 software test automation development, as well as 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 five years has been developing test automation written in Python 3 to test the leading edge of FLIR ONE (now in its third generation) infrared cameras for iPhone and Android smart phones and handheld tablets, as well as assuring the quality of FLIR bolometer IR camera platforms. Being highly appreciative of art, beauty, and programming, the author developed GUIs 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 FLIR Systems. Table of Contents Creating the GUI Form and Adding Widgets Layout management Look and feel customization Data and Classes Matplotlib charts Threads & Networking Database handling Testing & Internationalization Enhancing the GUI with the wxPython library Creating Amazing 2D GUIs with PyOpenGL and pyglet Best Practices

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值