Tkinter Python Task Manager GUI Project | Generalist Programmer | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Tkinter Python Task Manager GUI Project

teacher avatar Generalist Programmer, I am the generalist programmer

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

9 Lessons (37m)
    • 1. Course Introduction + Course Project

    • 2. Python Installation

    • 3. Setting up virtual environment

    • 4. Creating tkinter window

    • 5. Python tkinter frames

    • 6. Python tkinter place

    • 7. Database connection Python SQLITE

    • 8. Python create tables SQLITE

    • 9. Tkinter display tasks and add buttons

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

In this class we will learn the following skills:

- Python3

- Tkinter

- PySqlite

We will use pip3 to install our packages, create virtual environments and interact with a database to persist our data. The class project we will be building will give you a strong base to building cross platform Desktop applications which need to communicate with a database. We will also look at compiling our project to a binary or an executable which will allow you to package your application and send it to other people to run on their computers.

We will also cover some simple SQL queries for managing tasks, creating databases and creating tables.

Meet Your Teacher

Teacher Profile Image

Generalist Programmer

I am the generalist programmer


I have over 15 years experience in software development and plc programming and industrial automation. I am a hobbyist in game development using unity 3d and godot game engines and all things programming. I have worked in various sectors and positions in my career. Starting over 15 years ago in programming and development. I have experience in building commercial quality software solutions in the artificial intelligence, mobile, embedded hardware space for large corporations. With high demand for integrated software solutions. Some of my titles throughout my career include, software developer, senior software developer, lead architect and tech lead. I have experience in electrical and electronic development and integration with software where I would create full A-Z solutions. As well a... See full profile

Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Course Introduction + Course Project: Hey, guys. So in this course, we're going to be covering Python T Kinter, which is a library for building Gooey. They stop applications for multiple platforms such as Lennox, Windows and Mac. So in this course, we're going to be building a basic task manager, which will then persist Teoh SQL like database. We will be creating database tables as well as database connections and creating the raw DB file, which is required for persisting your data. So we're going to be building this basic toss manager, which allows us to add some tasks, and then we can remove some tasks as well as needed. So I will basically be covering some of the basics of tea Kinter, which includes some features as customizing you. I moving elements around grouping elements in different sorts of ways, creating the teak into a window. So this course is aimed at beginners in Pathan angry programming or ful advance python ears , which just want a very quick introduction to reprogramming just to kick off a project. So, guys, if you are interested in group programming than jump into this course with me now 2. Python Installation: So since this is a python antique intercourse, I'm not going to be covering too much of the installation off python itself for those beginners out there which is watching the course. So if you are on Mac, you would basically be using a command fold brew install. So it'll basically just like this and you type part three for you. Lennox users, it will see their that get in store prices. And on windows you will go to the python website and down erred a person installer which you can install on your windows machine. So, guys, please get Patton installed. My true this python three since said, is what we will be using in this course, and I will see you in the next year. 3. Setting up virtual environment: so guys had for you now have pipes and three installed. We now need to create a virtual environment where we can in segregate our libraries for our particular python project so that we don't have any conflicts with any other python versions or different projects. So it is advisable to create is Bush environments so that basically your project will run off this virtual environment and not have any issues when installing different libraries for the environment and also having conflicts with different versions of libraries. So in order to do this in my Lennix machine, I'm going to be typing virtual TNB or Mac and Windows, please. Do you research how to do this? It most likely is the same methodology. But do you just go online and just have a look at how that works? But I said, I'm just going to be typing virtual in he and to specify Plath, Inversion, Spice and three. And then I'm gonna give it a name of tea, Kinter. So you can call this what it be like. Usually it's other your project name or if you've got a particular name, which makes sense within your no stack being pleased you choose irrelevant name, but this I'm just choosing t contar because it's a teak intercourse. And then once you've done that, hit, enter. So now create a folder which will keep simply copy of the person, libraries and person dependencies, which you can then activate and allow your application to use. In order to do that, then we need Teoh. Actually activate the environment in the next source, and we go into Kinter Pond bakes once you hit enter. You'll see that in this print. This is is not teak injury here, which means we are operating in a teak inter environment that we created. So now we can go ahead and install some of our path and libraries. So we're not going to be installing T. Kinter in this because to Kinter ships by default with Python, we are just basically going to be installing sequel light at this point, sir, that we've got a way of creating databases tables and persisting our data in our initial python scripts. I wanted to do this just talking. Three school pie still, but it's on for version three a path, and you have to use three for two would just use pie sequel Lights. The guy didn't stall that and you'll see it successfully installed two guys. That's all you will need just to get started with this. In the next video, we'll start crowding up our basic script just to get some teak intra windows going, and then we'll take it from there to see you in the next video. 4. Creating tkinter window: So we now need to start with our those but of curd to just get a t kinter window going. In order to do that, I'm going to use my command line. Text editor You could be using sublime or visual studio card is quite useful for Pathan, but just to get the initial card going, I'm just going to be using, like, um, online editor to speed up the process. So I'm just thinking that dinner and I'm going Teoh create a mangled high file. And what we're going to be doing here is we're going to be importing T Kinter, and then we're going Teoh allow for creating a window, sitting in title and actually opening up our window that we can excessive. You are gooey. So I'm just from teeth in third and fourth Stop. Then we need Teoh. Create a main windows in order. Todo on bring to initialize the to T K, which stands for T Kinter Secret. Our initial window and end to sit. Our title I want to do is we want to then just run the main loop. So they actually create our so and it saved on this friend. This is part of the pie and you'll see that this is now created. Are I agree is to start off this. It's got excellent, maximize and minimize and toss Manager is our title the very basic stuff at this point just to get our window going. So some of the next thing we want to that good is just re sizing our window. So in order to do that, we can't go back into may end up I and someone called Main Sensitive Mainlander, or T care. Basically well, it's true, and we can specify the size of our just make 1,000,000 pixels, and you can save that. Run it again and you'll see that it is not created a window with those dimensions, and we can now actually start playing around with some you elements. In the next video. We're going to talk about frames and how they work and guys, hopefully this is useful so far and see in the next one 5. Python tkinter frames: So we now have our basic agree with our title and resized our windows. And now we need to start creating some. You are elements which we can put into our main window. So one of which is something called Frame. So frames divides our agree up into various sections or blocks within our main window. So I'm going to basically fall this course we going to create two different friends because we have section where we want to add tasks which is our input form or input fields. And in another section where we want to list out tasks, I'm just quickly going to create that and explain and demonstrate how this works. So the first thing I'm going to be doing is I'm going to be creating something called the Top Frame, which is Billy will be adding our tasks toe just frame, and we need Teoh Toll Person or T Kinter way. We need to put the spring, so we're going to be putting it inside our main window and then I'm going to create a close cream as well, and again it's going to go inside of our main window. So just to demonstrate how this works. I'm going to set some What's and hearts office these friends are with Will be 400 Heights is going to be 400 let's in the background off. Okay, well, this window here it's 400 and that blue. So there's basically if, around this I just want to show that this doesn't exactly work out, so it doesn't do anything at this point in time. So T Kinter comes with various different ways of adding green elements to windows and friends. It's a trap and as well as nesting different gree objects. So in order to show you how this works is back in tow quickly and what we'll run is something okay and close. When you run this again, you'll see that we've now got are two friends below one another. So the peck method basically stacks beauty items in order off execution on top of each other in your degree, and then stacks him in this particular manner. So you also get different types, so you will get a grid type, and also a place type is well, so let us like it crit, if we had to place this grid because you're and ready to do the same with plus friend ridiculed in column 10 We'll see that basically are now alongside one another in the grid. So we are alone. Rose zero and well, um, zero column one. So we can control our You are elements in our window in this fashion, and we could even do a place. So how that works, is we awesome parameters? We will, actually then look at that in the next video before this video gets too long. Yes, I heard. Brad, this is being useful so far. I'll see you in the next one. Show you how place works. Three elements. 6. Python tkinter place: Alright, guys, let's now look at the place method off stacking, are you? I elements in our main window. Let's open It may not pie again And let's change this to place nice here as well. So real won't be using columns and rows here will actually using gold It's on various padding Za tetra which options off place which can use So we can first of all, look at some offsets. I want to put this 100 Why say 50 400 why equals 4 50? I didn't see we can actually Then place are you are elements in any position we like we can customize This just gives you a lot of very allowable options to extend agrees quite but easily and like in or a bust. So some of the other options that you've got is you can anchor something so the options are north, east, south, west and east, etcetera, which basically will then prove it. The u element to you that the particular anchor. So when you do resize windows evolving, basically anchor angry size with that without anchor involves, you'll see that this is a Samara way. If I resize that, we know are you are elements don't actually move or resize or not really responsive with our windows. So the other thing is, you can also create heights and widths and also borders, so there are various options for the place method that you can use. I'd advise their two grown research these options further, but this is the basic idea of what place dances allows you to. Pretty sure you elements in particular places on your window and be able to customize that two guys. That's that's it for this video. I'm going to be starting with adding battens and input fields on the next video and hopefully couple of videos in, we'll start creating our tables and our databases well to start persisting tasks. It's a great guy, see in the next one. 7. Database connection Python SQLITE: So we now have created our frames. We've looked at different types of placement within our gooey, and now it's time to actually start creating some database connections or at least creating some type of scaffolding curd to allow us to run queries and do other things with our SQL like database. So for this, I've actually open up. Visual studio occurred so that we can write longer pieces of code and as well as create a database that pie file. So I've created this Brandy followed me here, which I'm going to say is they they start pie and we now going to start implementing a little bit of boiler plates that we can use to actually ransom queries on our database and be able to create our databases Well, so the first thing we're going to be needing is to import our SQL like libraries, and we also need to import an era class so that we can actually do some exception handling etcetera in this file. So this is extremely basic. It's not particularly the best pattern in bigger projects, but it is going Teoh give you a good understanding of how to do database queries with this with this girl lights a version of the python library and so that we can actually then do some persistence in our app as just a basis to start off your your knowledge of actually using databases with T Kinter in general. So let's start off with importing SQL Light three. So we need to import this and we need to import and it really close, which is also things come from it's feel like three import era. So we're going to you basically be creating two functions which will use So one is get connection, which will return a connection, and the other will just be an execute. Cleary function record was the last to execute some queries, and in they will import it into our main got pie file ending. After that in the next video will actually look at creating tables and a database. So let's start off with the connection function. So this is thing two. You pass in B file, so by default, believe it is blank will sit a connection to, you know, just in case we get to the end of our function and there is no connection initialized re initialize it to none from beginning. We've got to try except block. So what we're going to do is to try and create a database file and connect to it. If it fails out building, handle the exception with the area class or error event, and then we can just print out some user friendly error to know what the issue is. So it's not off your with just connections, said our connection to Excuse me what and the positive DP fall? Because sq light is a basically a flat file database which can live on operating system and can just be created in this fashion. So it makes it extremely convenient to to use with the smaller applications and just to get started with some type of persistence in your abs. So if this as posts, the try has succeeded before returning the connection so that we can actually use it. If it fails, there will be an exit, which is known as an exception on will use error. And this is relying this to be e. R. R. What we want to do now is because there has been an area defected. We want now print up a message so thank you so reasonably user friendly saying they waas this the database connection and what we want to do is add on the era at the inn so that we've got some type of detail to what the air awas finally closes, usually for closing the connection in our project. What we're going to do because we going to do multiple calls, we're just going to full finally and we're going to false, which means we're not going to be reading any card in the finally and then just right at the end. What we're going to do, return of connection through this is if Full has fell through and re essentially end up with the connection. That is none that we still return something for this function. The next thing we're going to be defining is our execute query fashion except Crew. And it will take connection, which will get from get connection in our next video, and let's then pass in an SQL string, which is going to contain, for example, Stream likes legs from pasts. He couldn't just simply pass in. So how is girl like works and what we have this week that something called a Christner, which just allows us to open a connection and start off at a place where we could actually do a query. And it has methods like execute which will allow us to execute queries in order to use that you think lt's try except block just catching eras. It's the or any thank you's fiction and we're going Teoh, just call the closer make food you can call executes on that's on our scale string and then we can just simply return our cursor if everything is passed If it has felt once again exception so well, it will accept their A and e r waas uh, create as well opinions off simple very so that we know what we ran on. And that's basically it for this database. That pie file. Now, just to show you how we actually include this into our main dirt pipes and we're just going to say and then that will allow us to actually import are better base of private file and start using it earnestly. We want to just emotional eyes that database so credible diesel connection on will say get . And we're just plus in a file, sir, what? I'm going to do is docked for the current folder, and I'm just like with the test. But so let's just give this around and see if this actually works this that pie from their base. Smooth tree import all our methods run the data based on pie file. From that and what will seen ours are, diesel opens up, and that's that's fine. So that's what we had before. But it has now created this taste that DB fall, which is currently blank. In the next video, we'll actually start creating tables and actually start putting some data into this a database so that we can actually see some records in here. The guy's great. I hope you've managed to get this far. It was both I'll see you in the next bed there 8. Python create tables SQLITE: so we don't have our database connection, which we've now created. A test dot db file for our escalate database, which is basically blank. We now need to start creating some tables which we can then work with and been insert some data just to see how this all works and heart fits together. So let's start off was just creating a sequel light tables for our tasks. So in order to do that, I'm just going to be sitting a very basic string to hold our actual Craig query way will share run the raw SQL query for creation. So what will juice the persons in text? You just have multi line strings is to have three quits and then we consent to start with our SQL wearied for creating our table. So we're going to just look at if the table exists, and if it does not mean we assume she will be creating our table. So here we're going to require sin Karlan and again requests. So first thing going to happen here to the i d to value and it will be a primary key Next. We just want to add a simple name. You can get at descriptions. What if you like to this? And this strange they created was also be a text build. So that's going to cover creating our table. And what we want to do is just run this query. So we use our connection, which we got from the top there, and we going Teoh run disc UAL create tables. So something from the previous video Let's a cynical in it. It won't create any interpretation or compel errors, but can be removed. Just stick to the standard of Pathan with simple colon's. Please, Do you agree that if you did at that in the previous video, So let's execute this and see if it creates anything guarded and run pleasant three main door pie. So this we've got, agree and open up our test. Be far. You can see that our first table has essentially been created in here. Let's now go ahead and stop, are up and actually do some inserts so that we can get some day that just close this tasty beef all said, well, only corrupted, so to populate update. Are you just going todo in some hypothetical data just so that you can play around. So in order to do that, I'm going to start for the four group on. I'm going to go for I in range with the value from 0 to 20 and then we're going to pass this bill to insert queries. I'm going to you just call this insert and again it's going to be able to string. So you wanted then adequate going to be inserted into tusks which we just created, and Regis came into name on me to cross values. In order to do that, I'm just going to call this teeth tossed and I'm going to insert pie, right, So off the bet. This isn't going to work. We have to specify if you're so that we do inject I into the string, then simply going Teoh, run this for basically So we need to be in this block and that, and finally would really need to do is just changes so around connection document. If you don't do this, it will persist on this round. But when you open up the app again, it's going to lose no changes. Seditious. Run this and see what the difference is in the test. But BB file sir. And that's and that's just how I like it, because this down Africa tous TV again, let's just say do open anyway so we can see that it's got some of our data in your now. It's not saving changes that was will corrupt our far, but it's not. Look at my just querying this database and seeing how we can get data out of it. In order to do that, I'm going. Teoh Credit query So Stream simply going to say Teoh result everything todo collection and this injury is going. Teoh return a cursor. Just make sure that we actually use connection so weakened in Basically go and say exults 54 it's just you four on this just right to see what happens. Don't see. We've got a whole bunch of your tasks and we pull these toss out of our table. So the guys, that is how we create tables, insert data and pull data back out of our this flight database. And, uh, yeah, that's it's a simpler is that really Tiu? Use escalate database in python, so in the next video will start looking at placing are three elements facing a few more agree elements and videos. After that, we're going to start looking at delusions and displaying our tasks. It's Adra toe. Hold on tight. We're going. Teoh. Almost be at the point with the class. Project is coming towards completion, so I'll see you in the next video. 9. Tkinter display tasks and add buttons: go. So we've created some tables in some data, and we've shown that we can actually read some data from my Escalade database. Let's now arrange. Are you I and just, sir add some buttons and fields into our your eye. So first of all, what I'm gonna do is I'm just going to clean up our frames. I don't want to have any background or once or anything in our friends because I want them Teoh resize Based on our US, I'm removing these. So the first couple of things we have to do is we want to create basically top frame, that we can have tasks. So in order to do that, we are going to group it in under off top frame. I'm going to start off by creating a button. So let's just call this course and we have to basically given the top friend, let's say six pools. We will like to be adding some local Kamande ritual allows to run Come on so that we can actually happen action on this button. But for now, we're just going to be focusing on displaying are here. I said before that I just want Teoh also define a input field, so that would be classed I plan on. We pulled that entry, so that's what you could fields. So I'm going to making just put in top frame every year, and that's all I'm going to do from now. What I want to do is I want to now place these in the correct position so that they are basically along side one another in the top frame. So in order to do that, I'm going to just say task no grid, and I'm going to put Colin x zero and I'm going Teoh button grab Look at the column at Sorry, one on the road in the next part is I want to actually look at the past from So what we'll do here is we're going to be looping through these task friends. So instead, off running this, I'm going to move this stuff so that we can look throughout different tasks. Yeah, just to make this a bit more transparent so that you understand what this is going to call this. I'm going to just I'm tasks. Right? So now what we want to do is we want to actually start creating some labels. So let's start off with Ankara, Tusk added. To toss friend this injury Teoh task and it is going to be field one. I believe we'll just have to double check that and somebody going t to say label Tiu, have a look at what it looks like and then take it from the so the top frame and toss friend, we now I'm not going to be doing this animal. We're just going to be picking them below whenever so the most. The display blow above on the mother from this looks, they re essentially and I have ah, toss button input Field and a bunch of us are very, very stable, though that's just the display portion in the next portion will look at actually creating a command where we can ran something and I'll explain a concept called Le MDA's Between me to master and alright guys, uh, just make sure that you've got in this fall so that you can continue with the next videos and then I'll see in the next one