WEBVTT 1 00:00:00.260 --> 00:00:02.030 Hi, guys, and welcome back. 2 00:00:02.030 --> 00:00:05.550 In this video we're going to be creating our notebook, 3 00:00:05.550 --> 00:00:09.210 and this is the start of our text editor. 4 00:00:09.210 --> 00:00:10.740 Let's create our notebook. 5 00:00:10.740 --> 00:00:14.188 So we'll say notebook equal ttk.notebook 6 00:00:14.188 --> 00:00:17.750 and put it inside main. 7 00:00:17.750 --> 00:00:21.040 Next up, let's say notebook.pack, 8 00:00:21.040 --> 00:00:24.970 and we're gonna type fill for both and expand equal true. 9 00:00:24.970 --> 00:00:27.900 What this is gonna mean since this is the only element 10 00:00:27.900 --> 00:00:30.200 inside our main frame, 11 00:00:30.200 --> 00:00:33.450 and the frame is also doing fill both and expand true, 12 00:00:33.450 --> 00:00:34.640 it means that this notebook is going to 13 00:00:34.640 --> 00:00:36.330 take up the entire window. 14 00:00:36.330 --> 00:00:37.163 By the way, notice that 15 00:00:37.163 --> 00:00:40.140 these pack methods don't have a side. 16 00:00:40.140 --> 00:00:43.230 That means side top by default. 17 00:00:43.230 --> 00:00:46.110 So let's press play in our app, and you'll see 18 00:00:47.510 --> 00:00:49.750 something that seems like nothing. 19 00:00:49.750 --> 00:00:52.080 That is because we have created a notebook, 20 00:00:52.080 --> 00:00:56.810 but we haven't created any files inside the notebook. 21 00:00:56.810 --> 00:00:58.033 Let's do that now. 22 00:01:00.330 --> 00:01:03.670 We'll say text_area equal tk.text, 23 00:01:03.670 --> 00:01:06.170 and we will put it inside the notebook. 24 00:01:06.170 --> 00:01:09.890 Text is different from entry in that text is a text area, 25 00:01:09.890 --> 00:01:12.320 so it takes up more room. 26 00:01:12.320 --> 00:01:15.450 It takes up some vertical space as well as horizontal space. 27 00:01:15.450 --> 00:01:18.550 Notice that the entry fields are just one liners. 28 00:01:18.550 --> 00:01:20.193 Text are multi-line. 29 00:01:21.120 --> 00:01:24.060 Then we will pack it with again 30 00:01:24.060 --> 00:01:28.398 fill both and expand equal true, 31 00:01:28.398 --> 00:01:33.398 and we will say notebook.add text area, 32 00:01:33.800 --> 00:01:37.213 and the title is going to be untitled for now. 33 00:01:38.670 --> 00:01:40.930 All right, let's press play. 34 00:01:40.930 --> 00:01:42.900 And you'll see that we are here. 35 00:01:42.900 --> 00:01:47.900 We have created our text area, and we have now a full width, 36 00:01:48.150 --> 00:01:49.963 full height element. 37 00:01:50.800 --> 00:01:53.780 Padx of one means that there is one element of padding 38 00:01:53.780 --> 00:01:55.390 on the left and the right. 39 00:01:55.390 --> 00:01:57.630 Pady of four comma zero 40 00:01:57.630 --> 00:01:59.920 means that is four of padding on the top 41 00:01:59.920 --> 00:02:01.370 and none on the bottom. 42 00:02:01.370 --> 00:02:03.273 You can get rid of those if you like. 43 00:02:04.810 --> 00:02:09.780 Next up, what we're gonna do is notebook.select text area, 44 00:02:09.780 --> 00:02:12.017 and what that's gonna do is as soon as you press play, 45 00:02:12.017 --> 00:02:15.950 that is going to be selected, which is the same as before; 46 00:02:15.950 --> 00:02:19.290 however, when you create multiple of these, 47 00:02:19.290 --> 00:02:22.750 you want to select the latest one you created. 48 00:02:22.750 --> 00:02:25.890 So what we'll do is we're going to put all of this here 49 00:02:25.890 --> 00:02:30.113 inside a function, which I'm going to call create file. 50 00:02:31.760 --> 00:02:35.780 Now, we can run create file down here, 51 00:02:35.780 --> 00:02:40.250 and it will create the same thing that we had before. 52 00:02:40.250 --> 00:02:44.300 But if we run create file multiple times, 53 00:02:44.300 --> 00:02:48.200 then we will always have the last one selected. 54 00:02:48.200 --> 00:02:50.840 This is going to be useful because when we create a new file 55 00:02:50.840 --> 00:02:53.150 using our menu or something like that, 56 00:02:53.150 --> 00:02:56.470 we do want to select the file that we've just created. 57 00:02:56.470 --> 00:02:57.670 That's why that's there. 58 00:02:58.770 --> 00:03:01.110 All right, so this is how you create a notebook, 59 00:03:01.110 --> 00:03:02.730 which is a collection of tabs 60 00:03:02.730 --> 00:03:05.050 with different elements inside it, 61 00:03:05.050 --> 00:03:06.920 and how you create text areas 62 00:03:06.920 --> 00:03:09.130 to put inside each of the tabs. 63 00:03:09.130 --> 00:03:11.010 Notice that you don't have to put text areas 64 00:03:11.010 --> 00:03:11.990 inside these tabs. 65 00:03:11.990 --> 00:03:13.740 You can put whatever you want in them, 66 00:03:13.740 --> 00:03:16.010 and so potentially, this could be a way of creating 67 00:03:16.010 --> 00:03:18.233 a tabbed menu if you wanted. 68 00:03:19.270 --> 00:03:20.660 That's everything for this video. 69 00:03:20.660 --> 00:03:21.590 Thank you for joining me. 70 00:03:21.590 --> 00:03:22.970 Now let's move on to the next one 71 00:03:22.970 --> 00:03:24.930 where we're going to be adding a menu 72 00:03:24.930 --> 00:03:27.000 so that we can create more files. 73 00:03:27.000 --> 00:03:28.050 I will see you there.