SlideShare a Scribd company logo
6
Most read
7
Most read
9
Most read
Introduction to Graphical
User Interfaces
WITH GUIZERO
Introduction to guizero
 Up to this point we have been creating console based
applications that interact with physical devices.
 However when was the last time you had a console based
application…almost never.
 We will be using the module tkinter to develop graphical
interfaces for our users to interact with during program
execution
 The tkinter module is comprised of numerous classes to
create GUI widgets.
 To simplify this process we will use the guizero module which is
a wrapper class, simplifying the implementation of GUI
components.
 From guizero import <INSERT WHAT YOU NEED>
Creating a Graphical User Interface
 There are 2 main components to a GUI.
 1. The window/container
 2. The widgets
 Labels, buttons, text boxes, radio buttons, images, etc.
Creating a Window
 Let’s begin by creating the application window, which is nothing more than a
container for our widgets.
 You will want to import the App class from guizero
 Code: from guizero import App
myApp = App()
myApp.display()
 However, this window will not do much for us unless we modify some of its
properties and add some content.
All the widgets go here
A Windows Starting Parameters/Properties
 When you create an App
windows you can specify any or
all of the below properties upon
creation or program execution.
 Code: myApp = App(title = “First App Window”, bg = “red”, height = 200, width = 250)
Creating a Text/Label Object
 A text is a widget that only displays information.
 Code: from guizero import App, Text
txtlName = Text(appName, optional parameters,…)
 Options include:
 Ex.
txtPrompt = Text(myApp, text =“ Enter a num:”, bg =“red”)
The Event Loop and Processing Events
 GUI’s are event driven, meaning they run when an interaction from the user occurs.
 To determine when an interaction occurs you have to create a listener for every programmable action
there is. These listeners are looking for actions, called events.
 Button Presses, Pressing Enter, Checking a Box, Selecting a Menu Option, …
 Python makes this a bit easier by using an event loop to listen for any interaction on your App window.
Widgets placed between the below two lines will have event listeners constantly checking if their event
has occurred. (More on this when we discuss widgets you can interact with)
 This is because the line of code myApp.display() starts the event loop. The GUI app will constantly check
whether the user has done anything new, and it will automatically update the display if necessary. The
event loop blocks the code, so code written after the event loop will never execute. So this loop acts
rather like a while True: loop.
Example
from guizero import App, Text
#create the window object
wind = App(title = “Our First App”, width = 200, height = 250)
#add a text label
txtName = Text(wind, text = “Jason Rocks!!!!”, fg = “blue”, font =“Helvetica”, size = 16)
#begin event loop
wind.display()
The Widget Classes
 When creating a widget there are
specific parameters for each to specify.
 Where to place it
 Properties
 Variables to set, etc.
 Many of the properties are similar for each
widget
 There are also functions/methods for each
widget to allow interaction.
Checkpoint
1. What is an event loop?
2. What are the 3 minimum lines of codes to create a GUI App?
3. What are widgets?

More Related Content

PPT
Sexualidad
PDF
Luận văn: Nhu cầu hoạt động công tác xã hội trong trường trung học phổ thông ...
PDF
Vì sao tâm lý trị liệu cần đến nhãn quan hậu hiện đại
PPTX
Chuong 2 Ngu am hoc - Dẫn luận ngôn ngữ - FTU
DOCX
Hoàn cảnh lịch sử và đường lối của đảng từ năm 1930 đến năm 1939
PPTX
GUI Programming using Tkinter-converted.pptx
PDF
A Complete seminar on GUI Development in python
PPTX
Introduction to Graphics
Sexualidad
Luận văn: Nhu cầu hoạt động công tác xã hội trong trường trung học phổ thông ...
Vì sao tâm lý trị liệu cần đến nhãn quan hậu hiện đại
Chuong 2 Ngu am hoc - Dẫn luận ngôn ngữ - FTU
Hoàn cảnh lịch sử và đường lối của đảng từ năm 1930 đến năm 1939
GUI Programming using Tkinter-converted.pptx
A Complete seminar on GUI Development in python
Introduction to Graphics

Similar to Introduction to GUIs with guizero (20)

PPTX
Chapter - 6.pptx
PDF
Exploring Python GUI Programming_ Creating User-Friendly Applications
PPT
Python is a high-level, general-purpose programming language. Its design phil...
PPTX
ITS-16163-Module 8-Graphic User Interface (GUI)
PPTX
d1c70870-58fb-4da8-ae54-28d1c44a7347.pptx
PDF
GUI In Python.pdf By : Sangeeta M Chauhan , Gwalior
PPTX
PYTHONNANGCAO_1.GUI.Creating the GUI Form and Adding Widgets.pptx
PPTX
tkinterpptxguipythonImport it is named ‘tkinter
PPTX
Tkinter_GUI_Programming_in_Pythovvn.pptx
PDF
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
PDF
Tkinter_GUI_Programming_in_ Python.pdf
PDF
Tkinter_GUI_Programming_in_Python.pdf
PPTX
Gui programming
PPTX
Python Training on python and SQL PPT.pptx
PDF
Python - gui programming (tkinter)
PDF
Python GUI Programming Tkinter and.pdf
PPTX
PYTHON - EXTRA Chapter GUI - MAULIK BORSANIYA
PPT
41 gui-design
PPT
41 gui-design
DOCX
Unit Three – User Interfac.docx
Chapter - 6.pptx
Exploring Python GUI Programming_ Creating User-Friendly Applications
Python is a high-level, general-purpose programming language. Its design phil...
ITS-16163-Module 8-Graphic User Interface (GUI)
d1c70870-58fb-4da8-ae54-28d1c44a7347.pptx
GUI In Python.pdf By : Sangeeta M Chauhan , Gwalior
PYTHONNANGCAO_1.GUI.Creating the GUI Form and Adding Widgets.pptx
tkinterpptxguipythonImport it is named ‘tkinter
Tkinter_GUI_Programming_in_Pythovvn.pptx
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Tkinter_GUI_Programming_in_ Python.pdf
Tkinter_GUI_Programming_in_Python.pdf
Gui programming
Python Training on python and SQL PPT.pptx
Python - gui programming (tkinter)
Python GUI Programming Tkinter and.pdf
PYTHON - EXTRA Chapter GUI - MAULIK BORSANIYA
41 gui-design
41 gui-design
Unit Three – User Interfac.docx
Ad

More from primeteacher32 (20)

PPT
Software Development Life Cycle
PPTX
Variable Scope
PPTX
Returning Data
PPTX
Intro to Functions
PPTX
Function Parameters
PPTX
Nested Loops
PPT
Conditional Loops
PPTX
Introduction to Repetition Structures
PPTX
Input Validation
PPTX
Windows File Systems
PPTX
Nesting Conditionals
PPTX
Conditionals
PPT
Intro to Python with GPIO
PPTX
Variables and Statements
PPTX
Variables and User Input
PPT
Intro to Python
PPTX
Raspberry Pi
PPT
Hardware vs. Software Presentations
PPTX
Block chain security
PPTX
Software Development Life Cycle
Variable Scope
Returning Data
Intro to Functions
Function Parameters
Nested Loops
Conditional Loops
Introduction to Repetition Structures
Input Validation
Windows File Systems
Nesting Conditionals
Conditionals
Intro to Python with GPIO
Variables and Statements
Variables and User Input
Intro to Python
Raspberry Pi
Hardware vs. Software Presentations
Block chain security
Ad

Recently uploaded (20)

DOCX
mcsp232projectguidelinesjan2023 (1).docx
PDF
MCQ Practice CBT OL Official Language 1.pptx.pdf
PDF
313302 DBMS UNIT 1 PPT for diploma Computer Eng Unit 2
PPTX
1-4 Chaptedjkfhkshdkfjhalksjdhfkjshdljkfhrs.pptx
PDF
esg-supply-chain-webinar-nov2018hkhkkh.pdf
PDF
Blue-Modern-Elegant-Presentation (1).pdf
PPTX
1751884730-Visual Basic -Unitj CS B.pptx
PPTX
Surgical thesis protocol formation ppt.pptx
PPTX
normal_menstrual_cycle_,,physiology.PPTX
PPTX
Autonomic_Nervous_SystemM_Drugs_PPT.pptx
PPT
APPROACH TO DEVELOPMENTALlllllllllllllllll
PPTX
The Stock at arrangement the stock and product.pptx
DOC
field study for teachers graduating samplr
PPTX
Your Guide to a Winning Interview Aug 2025.
PPTX
cse couse aefrfrqewrbqwrgbqgvq2w3vqbvq23rbgw3rnw345
PPTX
Condensed_Food_Science_Lecture1_Precised.pptx
PPTX
Principles of Inheritance and variation class 12.pptx
PDF
Why Today’s Brands Need ORM & SEO Specialists More Than Ever.pdf
PPT
Gsisgdkddkvdgjsjdvdbdbdbdghjkhgcvvkkfcxxfg
PPTX
Cerebral_Palsy_Detailed_Presentation.pptx
mcsp232projectguidelinesjan2023 (1).docx
MCQ Practice CBT OL Official Language 1.pptx.pdf
313302 DBMS UNIT 1 PPT for diploma Computer Eng Unit 2
1-4 Chaptedjkfhkshdkfjhalksjdhfkjshdljkfhrs.pptx
esg-supply-chain-webinar-nov2018hkhkkh.pdf
Blue-Modern-Elegant-Presentation (1).pdf
1751884730-Visual Basic -Unitj CS B.pptx
Surgical thesis protocol formation ppt.pptx
normal_menstrual_cycle_,,physiology.PPTX
Autonomic_Nervous_SystemM_Drugs_PPT.pptx
APPROACH TO DEVELOPMENTALlllllllllllllllll
The Stock at arrangement the stock and product.pptx
field study for teachers graduating samplr
Your Guide to a Winning Interview Aug 2025.
cse couse aefrfrqewrbqwrgbqgvq2w3vqbvq23rbgw3rnw345
Condensed_Food_Science_Lecture1_Precised.pptx
Principles of Inheritance and variation class 12.pptx
Why Today’s Brands Need ORM & SEO Specialists More Than Ever.pdf
Gsisgdkddkvdgjsjdvdbdbdbdghjkhgcvvkkfcxxfg
Cerebral_Palsy_Detailed_Presentation.pptx

Introduction to GUIs with guizero

  • 1. Introduction to Graphical User Interfaces WITH GUIZERO
  • 2. Introduction to guizero  Up to this point we have been creating console based applications that interact with physical devices.  However when was the last time you had a console based application…almost never.  We will be using the module tkinter to develop graphical interfaces for our users to interact with during program execution  The tkinter module is comprised of numerous classes to create GUI widgets.  To simplify this process we will use the guizero module which is a wrapper class, simplifying the implementation of GUI components.  From guizero import <INSERT WHAT YOU NEED>
  • 3. Creating a Graphical User Interface  There are 2 main components to a GUI.  1. The window/container  2. The widgets  Labels, buttons, text boxes, radio buttons, images, etc.
  • 4. Creating a Window  Let’s begin by creating the application window, which is nothing more than a container for our widgets.  You will want to import the App class from guizero  Code: from guizero import App myApp = App() myApp.display()  However, this window will not do much for us unless we modify some of its properties and add some content. All the widgets go here
  • 5. A Windows Starting Parameters/Properties  When you create an App windows you can specify any or all of the below properties upon creation or program execution.  Code: myApp = App(title = “First App Window”, bg = “red”, height = 200, width = 250)
  • 6. Creating a Text/Label Object  A text is a widget that only displays information.  Code: from guizero import App, Text txtlName = Text(appName, optional parameters,…)  Options include:  Ex. txtPrompt = Text(myApp, text =“ Enter a num:”, bg =“red”)
  • 7. The Event Loop and Processing Events  GUI’s are event driven, meaning they run when an interaction from the user occurs.  To determine when an interaction occurs you have to create a listener for every programmable action there is. These listeners are looking for actions, called events.  Button Presses, Pressing Enter, Checking a Box, Selecting a Menu Option, …  Python makes this a bit easier by using an event loop to listen for any interaction on your App window. Widgets placed between the below two lines will have event listeners constantly checking if their event has occurred. (More on this when we discuss widgets you can interact with)  This is because the line of code myApp.display() starts the event loop. The GUI app will constantly check whether the user has done anything new, and it will automatically update the display if necessary. The event loop blocks the code, so code written after the event loop will never execute. So this loop acts rather like a while True: loop.
  • 8. Example from guizero import App, Text #create the window object wind = App(title = “Our First App”, width = 200, height = 250) #add a text label txtName = Text(wind, text = “Jason Rocks!!!!”, fg = “blue”, font =“Helvetica”, size = 16) #begin event loop wind.display()
  • 9. The Widget Classes  When creating a widget there are specific parameters for each to specify.  Where to place it  Properties  Variables to set, etc.  Many of the properties are similar for each widget  There are also functions/methods for each widget to allow interaction.
  • 10. Checkpoint 1. What is an event loop? 2. What are the 3 minimum lines of codes to create a GUI App? 3. What are widgets?