Kivy with Python tutorial Part 8 - Simple Drawing Application
Skills:
AI Workflow Automation70%
Key Takeaways
This video tutorial demonstrates how to create a simple drawing application using Kivy with Python, utilizing touch input to draw lines on a canvas.
Full Transcript
hello everybody and welcome to the eth Ki Basics tutorial video with python in this video we're going to make a sort of uh drawing application so to do that from where we are it's actually not very much code because we are already tracking on touchdown on touch and on touch move we actually aren't going to need on touch up but I'm just going to leave it here because it's cool that we even have that so uh with that let's go ahead and import one one more thing and that is going to be from k. Graphics we want to import line with a capital l and that's to actually draw a line basically now what we want to do is on touchdown we want to begin a line so think of like you know you have a pencil you put the pencil to the paper and then starts to make a mark and then as you drag it around it continues you know marking on the paper so that's what we kind of want to do want touchdown we want to begin that Mark and then we want to continue that Mark as long as our touch is moving on even though in theory you might think in your head well don't we have to do something ontouch up to stop the line drawing no because ontouch move will just cease to exist anymore so we actually don't need to do anything there but anyway uh we need line and that's really all we have to add as far as Imports are concerned and now we just need to code the on touchdown and move stuff so I'm going to call this uh I don't know draw class draw input and then before we forget we need to take this right here and instead of touch input down here it needs to be draw input so I just want to change that other than other than that we're ready to go so now we say with self. canvas and this is the canvas of our application uh so self. canvas is just referring to that so you don't really need to like define canvas or anything so with self. canvas what do we actually want to do well we're going to say touch. UD and UD now uh we're going to reference the line element in there and we're going to say that is equal to line and we're going to say the points of that line is right now going to only be a single point in the line but the points for now are equal to touch dox touch doy so literally the X and Y values of of uh where we touch down so line at the moment is literally uh just actually a point it's not really a line it's simply a point but then what we do is we've since we've got that now what we're going to do is that should I'm going just make sure we close that off right yes so now we've got a line there and that will actually show something but not very much and then now on touch move what we want to do is we're going to say touch. UD uh and then again again we're referencing the line element whoops line like this and then we're going to say dot points plus equals and we want to plus equals the exact same thing pretty much right here so plus equals this so again this is just the this is the line function and we're saying we already established touch. UD line equals line which we imported up here and where we say the points of line so where we basically said line do points cuz touch UD uh line is equal to basically this line right up here so now we're saying line. points which originally line dot points was touch just X and Y of the original touch now we're saying we want to add to those points and we're adding every single movement of touch X and touch y we just add all of those movements and that's really it that's all we have to do with this and so now we can just save and run this hopefully and here we have our application and yeah sure enough you can click and you can start to write things so hi awesome and then we can actually you know resize this and we'll see that okay we just gained a lot more space and uh now we can write even more stuff and I'm really good at writing with the mouse tutorials you probably wouldn't even know that was tutorials immediately anyway so that's that that's pretty much all of um the basic basics for using canvas anyways but that's pretty cool like how quickly you can uh actually you know reference the drawing ability and the canvas ability of uh K so anyways I hopefully you guys enjoyed if you have any questions or comments please please feel free to leave them below otherwise as always thanks for watching thanks for all the support and subscriptions and until next time
Original Description
In this Kivy application development tutorial, we cover how to use the touch input from the user to create a simple drawing application, treating the presses from the user as a pencil.
sample code: http://pythonprogramming.net
http://seaofbtc.com
http://sentdex.com
http://hkinsley.com
https://twitter.com/sentdex
Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from sentdex · sentdex · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Matplotlib Python Tutorial Part 1: Basics and your first Graph!
sentdex
Python Encryption Tutorial with PyCrypto
sentdex
Python's Logging Function
sentdex
wxPython Tutorials 1: Making Windows GUIs with Python : Installing + 1st window!
sentdex
wxPython Tutorials 2: Making Windows GUIs with Python: Customizing Window Parameters
sentdex
wxPython Programming Tutorial 3: Menu Bar and Menu Button
sentdex
wxPython Programming Tutorial 4: Panels
sentdex
wxPython Programming Tutorial 5: User Input Saved To Variables
sentdex
wxPython Programming Tutorial 6: Multiple Choice Input
sentdex
wxPython Programming Tutorial 7: Adding Static Text and Colors
sentdex
wxPython Programming Tutorial 8: Custom Button Images
sentdex
wxPython Programming Tutorial 9: Tool Bar Items and Sub Menus!
sentdex
Basic PHP Tutorial 13: Multi-dimensional Array
sentdex
Basic PHP Tutorial 15: Functions and Global Variables
sentdex
Basic PHP Tutorial 12: Associative Array
sentdex
Basic PHP Tutorial 14: Foreach loop
sentdex
Basic PHP Tutorial 16: Include and Require
sentdex
Basic PHP Tutorial 7: Assignment, comparison and Logical operators
sentdex
Basic PHP Tutorial 4: Variables and Comments
sentdex
Basic PHP Tutorial 11: Arrays part 1, basic array
sentdex
Basic PHP Tutorial 6: If else and else if conditionals cont'd
sentdex
Basic PHP Tutorial 1: Intro to PHP
sentdex
Basic PHP Tutorial 3: HTML with PHP
sentdex
Basic PHP Tutorial 9: While Loop
sentdex
Basic PHP Tutorial 10: Switch Statement
sentdex
Basic PHP Tutorial 2: Print and Echo
sentdex
Basic PHP Tutorial 5: If else and else if conditional statements
sentdex
Basic PHP Tutorial 8: Arithmatic Operators: Doing math with php
sentdex
Basic PHP Tutorial 17: User Input Form Example / String Manipulation
sentdex
Basic PHP Tutorial 18: HTML Entities and forms cont'd
sentdex
Basic PHP Tutorial 19: Finding words in strings
sentdex
Basic PHP Programming Tutorial 20: Saving to a File / writing and appending
sentdex
Basic PHP Programming Tutorial 22: Hashing part 2: salting
sentdex
Basic PHP Programming Tutorial 23: Variables in Strings and tokenizing
sentdex
Basic PHP Programming Tutorial 21: MD5 Hashing For Security
sentdex
Basic PHP Programming Tutorial 24: String similarity
sentdex
Basic PHP Programming Tutorial 25: Time and Time stamps
sentdex
Basic PHP Programming Tutorial 26: Die and Exit
sentdex
Basic PHP Programming Tutorial 27: MySQL Databases Part 1
sentdex
Basic PHP Programming Tutorial 28: MySQL Database Part 2: Reading From Database
sentdex
Basic PHP Programming Tutorial 29: MySQL Database Part 3: Inputting Data
sentdex
Basic PHP Programming Tutorial 30: MySQL database in Use
sentdex
Django Tutorial Web Development with Python Part 1: Installing Django
sentdex
Python Tutorial: File Deletion and Folder Deletion / directory deletion
sentdex
Python Tutorial: How to Rename Files and Move Files with Python
sentdex
3D Graphs in Matplotlib for Python: Basic 3D Line
sentdex
3D Plotting in Matplotlib for Python: 3D Scatter Plot
sentdex
3D Charts in Matplotlib for Python: Multiple datasets scatter plot
sentdex
Sikuli Tutorial 1: Visually programming in python!
sentdex
Sikuli Tutorial 2: Program visually in python!
sentdex
Sikuli Tutorial 3: Program visually in python!
sentdex
3D Bar Charts in Python and Matplotlib
sentdex
3D Plane wire frame Graph Chart in Python
sentdex
Raspberry Pi Part 1 Introduction
sentdex
Raspberry Pi Part 8: First Download and Update! (Firmware)
sentdex
Raspberry Pi Part 10: How to set up a Linux Web Server on your Pi
sentdex
Raspberry Pi Part 11: Remote Desktop
sentdex
Twitter Analysis: How to rank a user's influence
sentdex
GPIO Tutorial for Pi Part 2 - Programming the GPIO
sentdex
GPIO Tutorial for Raspberry Pi Part 1 - Setting up
sentdex
More on: AI Workflow Automation
View skill →Related Reads
📰
📰
📰
📰
The Only AI Tools a Small Business Actually Needs in 2026
Dev.to AI
I Built an AI Life Planner the Month I Graduated and Switched to Linux Halfway Through
Dev.to · Hilal
Your Second Brain Is a Graveyard. Your AI Has Amnesia. (Part 1)
Medium · AI
The Python Automation Business I Started With 200 Lines of Code Eventually Replaced My Freelance…
Medium · Programming
🎓
Tutor Explanation
DeepCamp AI