《Tkinter GUI Application Development Blueprints》书中第五章音频播放器的bug改正

在第五章中的seekbar.py中有如下两个方法

    def on_seekbar_clicked(self, event=None):
        if event.x > 0 and event.x < self.width:
            self.slide_to_position(event.x)


    def slide_to_position(self, new_position):
        self.coords(self.red_rectangle, 0, 0, new_position, new_position)
        self.coords(self.seekbar_knob, new_position, 0)
        self.event_generate("<<SeekbarPositionChanged>>", x=new_position)


self.event_generate("<<SeekbarPositionChanged>>", x=new_position)这句代码的位置错了,应该改成:

    def on_seekbar_clicked(self, event=None):
        if event.x > 0 and event.x < self.width:
            self.slide_to_position(event.x)
            self.event_generate("<<SeekbarPositionChanged>>", x=event.x)


    def slide_to_position(self, new_position):
        self.coords(self.red_rectangle, 0, 0, new_position, new_position)
        self.coords(self.seekbar_knob, new_position, 0)

是应该当seekbar被点击后才用自定义事件传递点击位置,从而调整播放时间。

bug在于不是不能实现上述功能,而是会产生一个新的播放器去播放调整后的时间。


Tkinter is the built-in GUI package that comes with standard python distributions. This means it is easy to get started right away, without any extra installation or configuration. Tkinter’s strength lies in its simplicity of use and its intuitive nature which makes it suited for programmers and non-programmers alike. Once you get started, you will be surprised to see how a few lines of code can produce powerful GUI applications. Tkinter GUI Application Development Hotshot helps you learn the art of GUI programming – building real-world, productive and fun applications like text editor, drum machine, game of chess, media player, drawing application and many more. Each subsequent project builds on the skills acquired in the previous project. Also, learn to write multi-threaded and multi layered applications using Tkinter. Get to know modern best practices involved in writing GUI programs. Tkinter GUI Application Development Hotshot comes with a rich source of sample codes that you can use in your own projects in any discipline of your choice. Starting with a high level overview of Tkinter that covers the most important concepts involved in writing a GUI application, the book then takes you through a series of real world projects of increasing complexity, developing one project per chapter. After you have developed five full projects, the book provides you with some bare-bone skeleton codes for a few functional but incomplete projects, challenging you to put your skills to test by completing them. Finally, you are provided with tips for writing reusable, scalable, and quality GUI code for larger projects. The appendices provide a quick reference sheet for Tkinter. What you will learn from this book Structure your programs in the model-view framework Persist your application data with object serialization Work with external libraries and Tkinter extensions Write multi-threaded GUI programs Re-factor code at every stage of application development Integrate your GUI applications to backend database Use networking with your Tkinter program Apply Internationalization to your GUI applications Develop a GUI program framework for maximum code reuse and rapid application development
2016出版新书,2016.2.27重新上传,此pdf比我之前(2016.01.05)上传的那个版本更好。 Paperback: 304 pages Publisher: Packt Publishing - ebooks Account (January 6, 2016) Language: English ISBN-10: 1785287737 ISBN-13: 978-1785287732 Key Features This book empowers you to create rich cross-platform graphical user interfaces using Python It helps you develop applications that can be deployed on Windows, OSX, and Linux The recipes in the book involve real-world applications, giving you a first-hand experience of the practical scenarios Book Description wxPython is a GUI toolkit for the Python programming language built on top of the cross-platform wxWidgets GUI libraries. wxPython provides a powerful set of tools that allow you to quickly and efficiently building applications that can run on a variety of different platforms. Since wxWidgets provides a wrapper around each platform's native GUI toolkit, the applications built with wxPython will have a native look and feel wherever they are deployed. This book will provide you with the skills to build highly functional and native looking user interfaces for Python applications on multiple operating system environments. By working through the recipes, you will gain insights into and exposure to creating applications using wxPython. With a wide range of topics covered in the book, there are recipes to get the most basic of beginners started in GUI programming as well as tips to help experienced users get more out of their applications. The recipes will take you from the most basic application constructs all the way through to the deployment of complete applications. What you will learn Create full featured user interfaces Design and develop custom controls Deploy and distribute wxPython applications to Windows, Macintosh OS X, Linux, and other UNIX-like environments Handle and respond to application events Manage and display data using grids Interact with web services from your GUI Use Paint events to draw custom displays Support the display of user interfaces in multiple languages
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值