1 00:00:00,930 --> 00:00:05,330 Hello and welcome to part three of creatine. 2 00:00:05,340 --> 00:00:08,770 Hey count down timer with Python. 3 00:00:09,300 --> 00:00:18,520 So we are now going to set the end date when we want the our event to end. 4 00:00:18,540 --> 00:00:24,660 So we're not going to set up the end date so we can start counting the time. 5 00:00:24,660 --> 00:00:31,480 So we created a global variable here caught in time so I'm going to use that now. 6 00:00:31,630 --> 00:00:33,960 So I'll say and Ty 7 00:00:37,360 --> 00:00:43,320 I'm going to set that to equal to the date time 8 00:00:45,750 --> 00:00:48,270 dot the date 9 00:00:50,670 --> 00:00:53,500 time method. 10 00:00:54,120 --> 00:01:06,060 And inside that method inside in between the parent this is for this method is where I will specify 11 00:01:06,900 --> 00:01:10,610 when I want my event to hit. 12 00:01:11,250 --> 00:01:24,300 So you start with the year 2017 followed by the month is the ninth month followed by when I'm wanting 13 00:01:24,300 --> 00:01:28,060 to and I want it to end at the end of this month. 14 00:01:28,130 --> 00:01:31,480 I'll say it 38. 15 00:01:32,190 --> 00:01:33,070 OK. 16 00:01:33,450 --> 00:01:40,170 And then you pass him zero just to formatted and 0. 17 00:01:40,320 --> 00:01:49,260 So if you have a mom that doesn't end in 31 days 30 for example if you pull 31 and you know that September 18 00:01:49,290 --> 00:01:53,190 only has 30 days it hold true up an error. 19 00:01:54,990 --> 00:02:05,460 So this here the first zero will represent the hours and the second zero will represent the minutes. 20 00:02:05,490 --> 00:02:16,500 So now we've set a value for our time variable here which is going to equals to be the date time inside 21 00:02:16,540 --> 00:02:19,210 the daytime module. 22 00:02:19,350 --> 00:02:30,720 We have a method called date time and we pass passing it the value of the year the month the date and 23 00:02:30,720 --> 00:02:31,700 then the time. 24 00:02:31,710 --> 00:02:35,570 This for zero will represent the hours and seconds. 25 00:02:35,700 --> 00:02:44,440 And the other one represents the sorry the first zero represent the hours and the minutes and the other 26 00:02:44,440 --> 00:02:51,450 zero represent these seconds we imported the font from tick into. 27 00:02:51,510 --> 00:02:54,870 So let's try and use stats as well. 28 00:02:54,870 --> 00:03:00,530 So to use that we are going to create a variable here. 29 00:03:00,560 --> 00:03:10,210 I'm going to create a variable called half empty which is short for font you could call anything doesn't 30 00:03:10,230 --> 00:03:11,390 matter. 31 00:03:11,550 --> 00:03:16,440 We're going to send that to font dot font 32 00:03:19,690 --> 00:03:22,260 and the inside the parentheses 33 00:03:25,220 --> 00:03:27,660 of this font method. 34 00:03:28,110 --> 00:03:31,320 We are going to pass in several properties. 35 00:03:31,320 --> 00:03:37,040 First we want to pass in a font family. 36 00:03:37,160 --> 00:03:44,630 We are going to passing a font called Helvetica. 37 00:03:44,670 --> 00:03:50,500 Hell of a car OK. 38 00:03:50,740 --> 00:04:01,720 And next saying we want to do we want to give the fantasize so I'm going to set this to say what shall 39 00:04:01,720 --> 00:04:03,460 I give I'm going to make this 90 40 00:04:06,160 --> 00:04:19,180 and I want it to be bold so I say wait equals bold weight means how thick you want it to be outside 41 00:04:19,180 --> 00:04:30,190 just send it to bold Whoops I've got my it's my quote aren't side a parentheses it should be inside 42 00:04:31,660 --> 00:04:37,450 to save time I have completed the rest of the code here. 43 00:04:38,050 --> 00:04:40,330 So we've already covered this one. 44 00:04:40,330 --> 00:04:50,560 This is way high set the new variable for the font and the past in days values is here. 45 00:04:50,560 --> 00:04:56,950 This will be responsible for the size of the clock of the tick. 46 00:04:57,790 --> 00:04:58,270 Okay. 47 00:04:58,330 --> 00:04:59,670 Nothing at all. 48 00:04:59,870 --> 00:05:08,400 Not will control the size of the text on the screen here defined a variable or text. 49 00:05:08,580 --> 00:05:18,350 When you define a variable you can always change the values so this variable here I've set it to equal 50 00:05:18,380 --> 00:05:25,870 to a string var or that means is that this will accept string values. 51 00:05:25,900 --> 00:05:30,220 So the values that will be passed into this variable is going to be string. 52 00:05:30,280 --> 00:05:35,410 And here we go and label him using the T T K module. 53 00:05:35,410 --> 00:05:43,600 This one here and the label and musing here for the label which is the root which is that is the root 54 00:05:43,600 --> 00:05:45,100 of the application. 55 00:05:45,100 --> 00:05:53,260 I am certain it takes variable to close a text set in the font to cause to this font here the variable 56 00:05:54,030 --> 00:06:00,750 the foreground color which would be the color not the background color the color the front will be white 57 00:06:01,080 --> 00:06:02,870 the background would be blank. 58 00:06:03,580 --> 00:06:12,410 And here this here is used to position the clock on the screen. 59 00:06:12,410 --> 00:06:15,100 This uncle here positions it in the center. 60 00:06:16,060 --> 00:06:27,280 And this too here really relax and rewire her use to position the X on the y axis. 61 00:06:27,700 --> 00:06:30,750 And then here we've got the route the main loop. 62 00:06:31,030 --> 00:06:34,780 So this keeps the application running. 63 00:06:34,780 --> 00:06:40,140 So this is what keeps the clock running until you exit it. 64 00:06:40,750 --> 00:06:44,970 So it handles the event loop. 65 00:06:45,560 --> 00:06:45,920 Okay. 66 00:06:45,940 --> 00:06:54,490 So each time the event loops it handles it and it keeps the application running on till the window is 67 00:06:54,490 --> 00:06:55,200 closed. 68 00:06:55,580 --> 00:07:03,220 And when the windows closes usually cause the quit function here and then exits the application. 69 00:07:03,220 --> 00:07:04,750 So that should be it. 70 00:07:04,750 --> 00:07:08,840 So I'm just going to save this. 71 00:07:08,840 --> 00:07:19,870 Make sure that you format your code just like I have if not the editor here will complain is is very 72 00:07:19,870 --> 00:07:20,360 fuzzy. 73 00:07:20,920 --> 00:07:28,690 He likes it's code to be formatted in a setting way so if he complains just respond by formatting the 74 00:07:28,690 --> 00:07:30,090 code properly. 75 00:07:30,130 --> 00:07:31,240 So this is it. 76 00:07:31,570 --> 00:07:40,760 So I'm going to test to run the application so I'm going to click Run module. 77 00:07:42,310 --> 00:07:43,010 Okay. 78 00:07:43,030 --> 00:07:43,910 That is it. 79 00:07:44,620 --> 00:08:01,540 So it tells me I have 22 days left 22 days seven hours 58 minutes and 53 seconds left to my event. 80 00:08:01,540 --> 00:08:07,400 So you can always change the value of when you want a event to end. 81 00:08:07,510 --> 00:08:08,610 So that's it. 82 00:08:08,680 --> 00:08:11,670 You create a countdown time in Python. 83 00:08:11,680 --> 00:08:12,970 Thanks for watching. 84 00:08:12,970 --> 00:08:13,620 Bye for now.