1 00:00:00,660 --> 00:00:02,490 Hello and welcome. 2 00:00:02,490 --> 00:00:10,410 We are going to be creating a wheat conversion tool that will convert the feet to meters. 3 00:00:10,410 --> 00:00:17,250 This is going to be a three part video project so we'll start in part 1. 4 00:00:18,330 --> 00:00:25,320 It's always a good idea to try and design or sketch out what you want your application to look like 5 00:00:25,710 --> 00:00:28,350 before you actually go ahead and build it. 6 00:00:28,350 --> 00:00:30,830 So this is a rough sketch I've made. 7 00:00:31,080 --> 00:00:37,350 So the application is going to have a title which is going to say feet or meters it's going to have 8 00:00:37,350 --> 00:00:45,300 an input box where you enter the value in feet and then you press calculate button it would display 9 00:00:45,300 --> 00:00:47,640 the equivalent in meters. 10 00:00:47,760 --> 00:00:52,320 So I will be using the python Idol for this project. 11 00:00:52,320 --> 00:00:59,320 So to access the idol you click on your programs menu wherever your pipe on folder is you click on it 12 00:00:59,340 --> 00:01:01,950 and double click on the Python idol. 13 00:01:01,950 --> 00:01:04,630 And that would give you access to the shell. 14 00:01:04,740 --> 00:01:10,410 Once you've got the shell open we need to open a new file click click on new file. 15 00:01:10,830 --> 00:01:18,290 So this file here is where we'll create our project all the code will write or write it inside here. 16 00:01:18,300 --> 00:01:26,700 So the first thing to do is to save this file as a python file so you do save as it already knows it's 17 00:01:26,700 --> 00:01:29,680 going to be a python file so we just need to give it a name. 18 00:01:29,730 --> 00:01:35,960 So I'm going to call it F 2 meters. 19 00:01:36,870 --> 00:01:43,770 So feel free to call yours wherever you like and and save it in whatever location you want. 20 00:01:43,770 --> 00:01:47,280 I'm going to click on desktop and save mine to the desktop. 21 00:01:47,850 --> 00:01:54,660 So anything I create here now would become a python python file for this project. 22 00:01:54,660 --> 00:01:58,200 I want to use a couple of Python modules. 23 00:01:58,200 --> 00:02:02,460 So before you can use the modules in Python you have to import them. 24 00:02:02,970 --> 00:02:12,770 So I'm going to import it using the word from space followed by the name of the module is called T counter 25 00:02:13,710 --> 00:02:23,400 space followed by the word import space and then Asterix and the second module I'm going to import is 26 00:02:23,400 --> 00:02:42,000 called T Kent as well so take into space import space t t k so these two lines basically tells Python 27 00:02:42,450 --> 00:02:46,630 that our program needs these two modules. 28 00:02:46,860 --> 00:02:58,860 The first module is called take into this is the standard binding to Tiki which when load it also causes 29 00:02:59,340 --> 00:03:04,880 the existing T.K. library on your system to be loaded. 30 00:03:04,880 --> 00:03:09,750 So if you've got two kids on your system of course need to be loaded. 31 00:03:09,750 --> 00:03:22,800 The second module which is K is Python binding to the new are themed widgets that were added in TKD 32 00:03:22,800 --> 00:03:24,670 version eight point five. 33 00:03:24,720 --> 00:03:33,090 So the difference between the two is that with the teak into the first one you can configure the widgets 34 00:03:34,260 --> 00:03:36,980 you know almost as you like. 35 00:03:37,200 --> 00:03:45,220 Whereas the second one the TDK is more locked down but it's more professional. 36 00:03:45,240 --> 00:03:45,550 OK. 37 00:03:45,570 --> 00:03:52,380 So if you don't want if you want a professional looking widget or theme and you don't want to configure 38 00:03:52,380 --> 00:03:59,070 it much then Titi case your option but if you want to have total control then use the widgets within 39 00:03:59,070 --> 00:04:01,310 the tea counter module. 40 00:04:01,380 --> 00:04:11,040 Notice that we've imported everything from the teak into our module so so that we can call the T counter 41 00:04:11,580 --> 00:04:18,600 functions and every other thing that relating to that module so you can call them without prefix in 42 00:04:18,600 --> 00:04:18,860 them. 43 00:04:19,440 --> 00:04:20,160 OK. 44 00:04:20,190 --> 00:04:28,380 Which is the standard t keen to practice however because we've imported TDK itself. 45 00:04:28,560 --> 00:04:35,170 That means we'll need to prefix anything inside that t t care module. 46 00:04:35,400 --> 00:04:42,050 So if we're using like an entry entry module really we need to specify that. 47 00:04:42,060 --> 00:04:46,260 So if the entry entry we get is a t t k 1. 48 00:04:46,260 --> 00:04:56,760 So you need to specify Tiki dot entry you need that in order to invoke the function inside the T T K 49 00:04:57,090 --> 00:04:58,050 module. 50 00:04:58,050 --> 00:05:01,340 Sometimes you need both modules. 51 00:05:01,380 --> 00:05:06,710 Other times you need just the one depending on the context to save time. 52 00:05:06,730 --> 00:05:09,970 I've added some lines of code here. 53 00:05:10,200 --> 00:05:13,340 Okay so I've added these lines of code here. 54 00:05:13,350 --> 00:05:16,960 We've got the root cause to T.K.. 55 00:05:17,100 --> 00:05:23,480 Basically what we're doing here we are setting up the main window for the application. 56 00:05:23,880 --> 00:05:30,930 And here the root not title we've given it a title with calling it feet to meet. 57 00:05:30,960 --> 00:05:39,200 So this will be the title for the application and then created a frame we get. 58 00:05:39,240 --> 00:05:39,680 Okay. 59 00:05:39,690 --> 00:05:48,930 This is a frame widget which will hold all the content of our user interface and also police will pleased 60 00:05:48,930 --> 00:05:53,630 that inside the main window we defined the main window here. 61 00:05:53,730 --> 00:05:58,860 So this frame will be placed inside the main window. 62 00:05:58,860 --> 00:06:03,800 This bit here the column configure this be here. 63 00:06:03,900 --> 00:06:05,430 What that what that does. 64 00:06:05,520 --> 00:06:15,780 It tells Tiki that if the main window is resized the frame should expand to take up the extra space. 65 00:06:15,810 --> 00:06:16,280 OK. 66 00:06:16,350 --> 00:06:19,680 That's what this line does. 67 00:06:19,680 --> 00:06:22,840 Rule number go row here. 68 00:06:22,860 --> 00:06:24,910 The the rule configured. 69 00:06:24,930 --> 00:06:33,690 Basically what that will do it will configure the row so the random number basically is the rule into 70 00:06:33,690 --> 00:06:40,420 which you want to insert your which and the default counting starts from zero. 71 00:06:40,470 --> 00:06:46,070 So the default is in the next higher and higher value for the. 72 00:06:46,070 --> 00:06:48,450 On occupied rope. 73 00:06:48,480 --> 00:06:49,470 Notice we've got 74 00:06:52,260 --> 00:06:55,090 the sticky option here. 75 00:06:55,090 --> 00:06:56,910 This sticky here. 76 00:06:56,910 --> 00:07:05,330 Basically this option determines how to distribute in the extra space within the cell. 77 00:07:05,400 --> 00:07:10,520 That is not taken up by the widget. 78 00:07:10,830 --> 00:07:18,570 If you do not provide a sticky attribute their deferred default behavior basically will is to center 79 00:07:18,960 --> 00:07:20,960 the widget in the cell. 80 00:07:21,000 --> 00:07:30,750 You can position the widget in a corner of the cell by using the sticky word and he has certain values 81 00:07:30,810 --> 00:07:44,460 so these values refers to the way you can stick make the widget stick in the cell and W refers to refers 82 00:07:44,460 --> 00:07:48,160 to not from bottom to left. 83 00:07:48,240 --> 00:07:57,240 OK so if you're doing w sorry it's top left and W refers to top left you want it to be position on top 84 00:07:57,240 --> 00:08:11,130 left and then e e refers to e will be the right center and then it will stretch the widget in a vertical 85 00:08:11,280 --> 00:08:14,060 position so that's what these values are. 86 00:08:14,220 --> 00:08:23,970 They are geometric values and these values are all part of the agreed method. 87 00:08:23,970 --> 00:08:30,690 So I'm going to end this lecture here and we will carry on in part 2. 88 00:08:30,780 --> 00:08:32,180 So say in part 2. 89 00:08:32,190 --> 00:08:33,120 Thanks for watching.