
Building User Interfaces with Python Tkinter
A complete guide to developing graphical user interfaces
Design windows, buttons and menus for Python programs with Tkinter, then try Kivy for touch interfaces.
What you'll learn
- Use the core widgets: Button, Label, Entry, Frame and Listbox
- Create menus, radio buttons, scrollbars and scales
- Work with Text, Spinbox, PanedWindow and LabelFrame
- Show information, warning, error and question dialogs with message boxes
- Build the Python Web Blocker and deploy it on Linux and Windows
- Understand the Kivy architecture, install it and write a Hello World program
- Use Kivy widgets such as buttons, sliders and progress bars
- Arrange elements with Kivy layouts and create a login window
About this book
This book explains the Tkinter library for building graphical user interfaces in Python, widget by widget. It starts with the basic widgets such as Button, Canvas, Checkbutton, Entry, Frame, Label and Listbox, then Menu, Message, Radiobutton, Scale and Scrollbar, then Text, Toplevel, Spinbox, PanedWindow, LabelFrame and message boxes.
Next it presents a hands-on project, the Python Web Blocker, which blocks chosen websites through the hosts file and is deployed on Linux and Windows. It closes with the Kivy library: what it is, its features, its architecture and installation, then a Hello World program, buttons, widgets, layouts, a popup window and a login window.
The book suits readers who know the basics of Python and want to turn command-line programs into windowed apps. By the end you will be able to build a program with windows, buttons, menus and alert dialogs.
Who this book is for
- Python programmers who want a graphical interface for their programs
- Programming students building a project with windows and buttons
- Developers who want to get to know Kivy for touch interfaces
- Hobbyists who want a small, easy-to-use tool of their own
- Teachers looking for examples to teach GUI programming
Why read this book
- An explanation of every Tkinter widget with its methods
- A full hands-on project, the Python Web Blocker
- Two libraries, Tkinter and Kivy, covered in one book
- Message boxes explained, such as showinfo, askyesno and askretrycancel
Reader reviews
Table of contents
1الفصل الأول
- أساسيات Tkinter
- زر Python Tkinter
- Python Tkinter Canvas
- زر الاختيار من Python Tkinter
- الأساليب
- دخول Python Tkinter
- طرق أداة الدخول
- إطار Python Tkinter
- تسمية Python Tkinter
- Python Tkinter Listbox
- الأساليب
2الفصل الثاني
- Python Tkinter Menubutton
- قائمة Python Tkinter
- الأساليب
- إنشاء قائمة المستوى الأعلى
- رسالة Python Tkinter
- Python Tkinter Radiobutton
- الأساليب
- مقياس Python Tkinter
- شريط تمرير Python Tkinter
3الفصل الثالث
- نص Python Tkinter
- الأساليب
- طرق معالجة العلامات
- طرق معالجة العلامات
- Tkinter Toplevel
- الأساليب
- Python Tkinter Spinbox
- الأساليب
- Tkinter PanedWindow
- الأساليب
- Tkinter LabelFrame
- صندوق رسائل Tkinter
- المعايير
- إظهار المعلومات()
- إظهار التحذير()
- showerror()
- askquestion()
- askokcancel()
- askyesno()
- askretrycancel()
4الفصل الرابع
- Python Web Blocker
- مقدمة
- الهدف
- العملية
- ملف hosts
- موقع ملف المضيفين
- التكوين
- المتطلبات
- بناء البرنامج النصي python
- إعداد الحلقة اللانهائية
- تحديد الوقت
- الكتابة إلى ملف المضيّفين
- إزالة من ملف hosts
- البرنامج النصي النهائي
- نشر البرنامج النصي على نظام Linux
- الإجراء
- نشر البرنامج النصي على Windows
5الفصل الخامس
- Kivy
- شرح كيفي التعليمي
- ما هو Kivy ؟
- ميزات Kivy
- الفيديو
- للمس المتعدد والإيماءات
- ميزات واجهة المستخدم
- المؤثرات البصرية و OpenGL
- المرونة
- مجاني
- مزايا وعيوب Kivy
- المزايا
- العيوب
- بنية Kivy
- المُزوّدات الأساسيّة ومزوّدات الإدخال
- الرسومات
- النواة
- UIX
- الوحدات النمطية
- أحداث الإدخال
- الأدوات وإرسال المدخلات
- تثبيت Kivy على Windows
- تثبيت Kivy
- إنشاء برنامج Hello World في Kivy
- إضافة أداة الصورة في Kivy
- من النظام
- التحميل غير المتزامن
- أزرار Kivy
- إنشاء زر مميز
- إضافة صورة في الزر
- أدوات Kivy Widgets
- المنزلق
- أداة التبديل
- شريط التقدم
- تخطيطات Kivy
- تخطيط الشبكة
- تخطيط الصندوق
- التخطيط العائم
- تخطيط المرساة
- StackLayout
- إنشاء نافذة منبثقة في Kivy
- إنشاء نافذة تسجيل دخول في Kivy
- المتطلبات الأساسية
- الجمهور
- المشكلة
- القائمة المدرجة في كيفي
