WEBVTT 1 00:00:00.160 --> 00:00:02.730 Hi guys and welcome back. 2 00:00:02.730 --> 00:00:06.101 In this section, we're going to start looking at Tkinter. 3 00:00:06.101 --> 00:00:08.770 And we're gonna be using Python 3. 4 00:00:08.770 --> 00:00:10.770 I know that most of you are already using Python 3, 5 00:00:10.770 --> 00:00:13.290 but for this section, it is especially important 6 00:00:13.290 --> 00:00:14.397 that you use Python 3 7 00:00:14.397 --> 00:00:18.620 because it has all the latest Tkinter updates. 8 00:00:18.620 --> 00:00:21.100 Use the latest version that you can. 9 00:00:21.100 --> 00:00:23.949 In this case I'm gonna be using Python 3.7. 10 00:00:23.949 --> 00:00:27.930 3.8 has just come into beta, so I'm not using it yet, 11 00:00:27.930 --> 00:00:29.900 but what we covered in this section 12 00:00:29.900 --> 00:00:33.470 should work for Python 3.8 and later as well. 13 00:00:33.470 --> 00:00:35.277 As I said though, I'm using 3.7 14 00:00:35.277 --> 00:00:37.403 and I recommend you do as well. 15 00:00:38.820 --> 00:00:42.376 In order to create a project in PyCharm using Python 3.7, 16 00:00:42.376 --> 00:00:44.189 I'm sure you know how to do that already. 17 00:00:44.189 --> 00:00:47.580 I'm just going to create a folder for my project 18 00:00:47.580 --> 00:00:51.630 and I'm gonna call it gui development. 19 00:00:51.630 --> 00:00:54.380 Make sure to not call your project Tkinter, 20 00:00:54.380 --> 00:00:58.320 as that is going to conflict with the imports later on. 21 00:00:58.320 --> 00:00:59.980 And then for the environment, 22 00:00:59.980 --> 00:01:02.756 select a new environment using pipenv 23 00:01:02.756 --> 00:01:05.456 and then make sure the base interpreter is Python 3.7. 24 00:01:06.616 --> 00:01:08.760 All right, that's everything you need 25 00:01:08.760 --> 00:01:12.270 in order to create your project. 26 00:01:12.270 --> 00:01:16.643 So once that's done, we should be able to use Tkinter. 27 00:01:18.200 --> 00:01:21.010 To verify that Tkinter is working in your system, 28 00:01:21.010 --> 00:01:24.144 all you have to do is create a file inside this project. 29 00:01:24.144 --> 00:01:27.650 And name it whatever you want, I'm gonna call it test.py. 30 00:01:27.650 --> 00:01:30.576 And in here, type import tkinter. 31 00:01:30.576 --> 00:01:35.270 Now if, as you're typing, PyCharm has this recommendation, 32 00:01:35.270 --> 00:01:37.710 that means you're all good to go, that's first of all. 33 00:01:37.710 --> 00:01:41.670 But just to make 100% sure, after import tkinter, 34 00:01:41.670 --> 00:01:45.954 type tkinter_test, like that. 35 00:01:45.954 --> 00:01:49.540 Now PyCharm will complain about this, but that's okay. 36 00:01:49.540 --> 00:01:51.722 And we're going to run this file 37 00:01:51.722 --> 00:01:54.865 and you should get a little window 38 00:01:54.865 --> 00:01:56.670 that looks similar to this. 39 00:01:56.670 --> 00:01:58.970 If you get anything at all, that isn't an error, 40 00:01:58.970 --> 00:02:00.090 that means you're good to go. 41 00:02:00.090 --> 00:02:04.050 But, you should get a little window 42 00:02:04.050 --> 00:02:09.034 that is essentially a sample Tkinter app. 43 00:02:09.034 --> 00:02:12.310 If that happens in your system, you're good to go, 44 00:02:12.310 --> 00:02:13.800 you can continue to the next video. 45 00:02:13.800 --> 00:02:17.820 If it doesn't, you'll need to go through installing Tkinter. 46 00:02:17.820 --> 00:02:21.700 Now that is fairly straightforward in most systems. 47 00:02:21.700 --> 00:02:24.360 All you have to do is reinstall Python 48 00:02:24.360 --> 00:02:27.283 or instal a late version of Python, like 3.7, 49 00:02:28.200 --> 00:02:32.930 and make sure that tk/tcl is selected in the instal. 50 00:02:32.930 --> 00:02:34.500 And you shouldn't have to worry about it 51 00:02:34.500 --> 00:02:37.343 on Mac and on Linux, it should all just work fine. 52 00:02:38.750 --> 00:02:39.829 Thanks for joining me in this video. 53 00:02:39.829 --> 00:02:42.250 Let's get started with Tkinter. 54 00:02:42.250 --> 00:02:43.700 I'll see you in the next one.