Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Tkinter GUI Application Development Blueprints

You're reading from  Tkinter GUI Application Development Blueprints

Product type Book
Published in Nov 2015
Publisher Packt
ISBN-13 9781785889738
Pages 340 pages
Edition 1st Edition
Languages
Author (1):
Bhaskar Chaudhary Bhaskar Chaudhary
Profile icon Bhaskar Chaudhary

Table of Contents (15) Chapters

Tkinter GUI Application Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Meet Tkinter 2. Making a Text Editor 3. Programmable Drum Machine 4. A Game of Chess 5. Building an Audio Player 6. Paint Application 7. Multiple Fun Projects 8. Miscellaneous Tips Index

Adding functionality to menu items


Recall that, at the time of creating our menu using the Framework class, we created empty methods that were linked to our menu items. We now modify those empty methods to make them functional (see code 6.09.py)

File | New Menu: The canvas delete method can be used to delete an item, given an item-specifier. Here we use ALL to delete all items from the canvas:

    def on_new_file_menu_clicked(self, event=None):
          self.start_new_project()

    def start_new_project(self):
          self.canvas.delete(ALL)
          self.canvas.config(bg="#ffffff")
          self.root.title('untitled')

File | Save, File | Save As: Tkinter lets you save canvas objects as a postscript file using the command postscript(). Note, however, that the resulting postscript file cannot save images or any widgets embedded on the canvas. Further, note that the pickling of Tkinter widgets or saving to .jpg or .png formats is not possible. This is one of the major limitations of Tkinter...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime}