1 00:00:05,640 --> 00:00:10,100 Here everyone since the last video we have learned about creating a window in this video. 2 00:00:10,110 --> 00:00:11,900 We will go for the first visit. 3 00:00:11,940 --> 00:00:12,660 That is a button. 4 00:00:13,530 --> 00:00:19,410 So here have my Adam and the terminal here with the extra battery. 5 00:00:20,150 --> 00:00:26,740 So now first of all at minimum this one and no adding any widget is very simple. 6 00:00:27,160 --> 00:00:33,810 You just need to create a variable declare digit and then just show that widget on the window. 7 00:00:34,150 --> 00:00:39,970 That begins with creating a variable like B and you just need to add here the fidget name like button 8 00:00:40,210 --> 00:00:49,420 for a button canvas for canvas frame for frame in which always the first trade is capital then you need 9 00:00:49,420 --> 00:00:55,330 to pair past differences in which first you need to define that in which window you want. 10 00:00:55,330 --> 00:00:55,910 This one. 11 00:00:56,020 --> 00:00:58,870 Like if I found this one in my first window win. 12 00:00:59,610 --> 00:01:01,580 Then just win here. 13 00:01:01,630 --> 00:01:09,340 Then some text you want to show on your button say button you have this I know you tried to run this 14 00:01:09,340 --> 00:01:09,840 one here. 15 00:01:12,370 --> 00:01:16,000 You will get a running window but you would not get any button there. 16 00:01:16,000 --> 00:01:16,990 There it is. 17 00:01:16,990 --> 00:01:19,310 We do not have any button on the window. 18 00:01:19,480 --> 00:01:25,710 That's because declaring a button is one but then showing the button is another. 19 00:01:25,720 --> 00:01:31,910 This one is just like printing any text but here we will use back methods. 20 00:01:32,250 --> 00:01:40,300 We had three methods here that is first one back then we have grid and then we have a last place. 21 00:01:40,410 --> 00:01:45,870 So these methods are just like printed text but here they're printing division because they are performing 22 00:01:45,870 --> 00:01:49,900 something so we cannot use a print here. 23 00:01:49,900 --> 00:01:52,180 There is a video about these three in the last. 24 00:01:52,180 --> 00:01:55,750 You can post that one but hey I will give you a basic introduction. 25 00:01:55,760 --> 00:02:00,200 You will not get any problem with this because they are very small topic. 26 00:02:00,780 --> 00:02:02,720 So how do we work. 27 00:02:02,790 --> 00:02:07,260 Let me show you these that what they have in their working their work simply like. 28 00:02:07,290 --> 00:02:12,500 First I need to have my variable B and then just add the method like first. 29 00:02:12,540 --> 00:02:20,640 Back then the printed save this one and now when you run this file you will get your button. 30 00:02:20,640 --> 00:02:26,010 Here it is on the top and middle of the columns. 31 00:02:26,010 --> 00:02:31,130 Now if I also had the geometrical window geometry 32 00:02:34,600 --> 00:02:44,000 and that money's say 400 x 400 this one into quotes save this one. 33 00:02:44,010 --> 00:02:47,610 And now if you run this one here you will again. 34 00:02:47,610 --> 00:02:54,330 We the other in geometry there is a spelling mistake maybe that is geo Amity. 35 00:02:54,380 --> 00:02:55,980 Here we have extra. 36 00:02:57,290 --> 00:03:02,570 My friends do and here I have this one for under 400 and the button people. 37 00:03:03,530 --> 00:03:07,010 And if I add another button here that is B2 38 00:03:09,920 --> 00:03:14,600 and with the name say only be you save this one. 39 00:03:15,110 --> 00:03:17,310 And on this one here no. 40 00:03:17,720 --> 00:03:20,100 You will get b you below this one. 41 00:03:20,120 --> 00:03:22,450 Now there's some issues here. 42 00:03:22,490 --> 00:03:24,320 Like what if I need my button here. 43 00:03:25,350 --> 00:03:26,660 Now how can I get that one. 44 00:03:27,170 --> 00:03:34,310 So bag method simply just put the button wherever it get according to the number of command it had like 45 00:03:34,310 --> 00:03:37,920 be its first declare so be heavy have be about. 46 00:03:38,090 --> 00:03:46,500 Then we have b do so b don't dip below B button then not to access these buttons with the locations 47 00:03:46,530 --> 00:03:52,740 we have these second and third method that are grid and place really something like Hey if you notice 48 00:03:52,740 --> 00:03:56,280 on this window particular here we have 13 rows. 49 00:03:56,280 --> 00:04:01,470 So my first this text on number one this one is on number seven. 50 00:04:01,470 --> 00:04:08,190 That is something by programming here on grid method we access the location by rules and column like 51 00:04:08,190 --> 00:04:09,330 this one save. 52 00:04:09,350 --> 00:04:12,640 Draw six and the first letters column 1. 53 00:04:12,720 --> 00:04:16,760 So here I have B on sixth through and first column. 54 00:04:16,920 --> 00:04:24,910 So if I use here grid method then I need to here pass Number two rule and number of column save one. 55 00:04:25,620 --> 00:04:29,600 And also the column equal to 1. 56 00:04:29,610 --> 00:04:30,300 Same here 57 00:04:33,950 --> 00:04:34,760 save this one. 58 00:04:34,770 --> 00:04:41,910 And now if you run this one here you will get and and b you and button here. 59 00:04:42,140 --> 00:04:48,290 That is one about the dump because here we have the same row same column. 60 00:04:48,410 --> 00:04:57,870 If I do this one wrote two and now run that one I will have this one on separate line but button on 61 00:04:57,870 --> 00:05:04,480 first and beyond second I can also do this one first and this one second. 62 00:05:04,480 --> 00:05:07,790 Now I will get b you on top. 63 00:05:07,990 --> 00:05:15,450 David B although and then button on second as B have we have B you defined later but now by using grid 64 00:05:15,480 --> 00:05:18,800 we had this one about you can also choose the columns. 65 00:05:18,870 --> 00:05:27,520 If I do this one in two columns to say this one and if you run that one we have the B you here on column 66 00:05:27,520 --> 00:05:32,480 two because first column is considered by button. 67 00:05:32,700 --> 00:05:38,880 Now the third one that is the place method that I personally before you my place method you can place 68 00:05:38,880 --> 00:05:43,620 your button any way you want to individual like here. 69 00:05:43,620 --> 00:05:51,580 I have first one on X equal to here you need to pass x axis and Vi axis both will be in pixels save 70 00:05:51,600 --> 00:05:57,660 us to one on hundred on x axis and two hundred viruses. 71 00:05:57,660 --> 00:06:11,670 And the second one say hundred an x axis and three to do a D on y axis come on this and divide and D 72 00:06:11,670 --> 00:06:22,570 Here I got some arrows here and denote positive y equal to now here if I had on this one day we have 73 00:06:22,870 --> 00:06:28,990 this one button that is the second one so the first one on X is equal two hundred. 74 00:06:28,990 --> 00:06:34,570 This is the hundred through and column equal to two hundred and this one X is equal to three hundred 75 00:06:35,230 --> 00:06:42,340 and y is equal to two hundred and eighty so that's all you can use the place method to place the buttons 76 00:06:42,430 --> 00:06:48,760 anywhere on the location you want to and this one is better than the other two because you can access 77 00:06:48,790 --> 00:06:55,760 any location now this is all about creating a button and placing the button anyway location. 78 00:06:55,790 --> 00:06:57,940 Now what about the button. 79 00:06:58,070 --> 00:06:59,470 At present the button is useless. 80 00:06:59,480 --> 00:07:00,830 It doesn't do anything. 81 00:07:00,830 --> 00:07:02,610 It is just a button on my finger. 82 00:07:03,140 --> 00:07:09,120 So what is the benefit of a empty bed for that one we use here. 83 00:07:09,140 --> 00:07:15,800 The options if you go to the notes and open the buttons notes you will find first of all here we had 84 00:07:15,800 --> 00:07:21,140 this syntax is there we have dependent widows in which we have is the main window option is the options 85 00:07:21,140 --> 00:07:21,700 available. 86 00:07:21,710 --> 00:07:25,810 Then here we have the options that will define everything above the button. 87 00:07:25,820 --> 00:07:34,800 You can stand it's background front foreground color and you can also add commands let me show you some 88 00:07:34,800 --> 00:07:35,450 of these. 89 00:07:35,550 --> 00:07:42,780 You can refer any of these you phone to I will show you some device the video will be very large and 90 00:07:42,810 --> 00:07:46,520 all the others have it nearly seem so you will not get any problem. 91 00:07:46,800 --> 00:07:53,540 First of all if I need to make my button to do something for that I have a barometer known as. 92 00:07:53,550 --> 00:08:01,200 Come on that will do something when clicking the button and for that one we have two options like adding 93 00:08:01,200 --> 00:08:06,750 the come on here or defining the command and then calling the command by using a function. 94 00:08:06,750 --> 00:08:09,610 But there's a problem with defining the command here. 95 00:08:09,810 --> 00:08:18,000 Like if I just do print high on plugging the button then when you run this one. 96 00:08:18,000 --> 00:08:23,640 And even if you do not click that particular button first let me clear this one so that you will see 97 00:08:23,640 --> 00:08:24,660 on the. 98 00:08:24,660 --> 00:08:29,840 Come on here you will get the output in the terminal not on the window. 99 00:08:29,880 --> 00:08:32,100 We will consider that one later. 100 00:08:32,450 --> 00:08:34,050 Now if I on this one. 101 00:08:34,050 --> 00:08:38,830 Hey if you notice I have high on determiner not on that one. 102 00:08:38,830 --> 00:08:43,470 And even if I click this one no I did not have anything happening anywhere. 103 00:08:44,110 --> 00:08:49,680 So that is the drawback of adding the command on the same line. 104 00:08:49,730 --> 00:08:53,120 Now what about calling to come on here. 105 00:08:53,140 --> 00:08:58,770 My boss just any name CPI and define a function with the same name. 106 00:08:58,810 --> 00:09:02,840 Here we have PR fences brain type. 107 00:09:02,890 --> 00:09:09,300 The same common knife you save and run that one. 108 00:09:09,670 --> 00:09:15,520 I have this one and there is nothing printed here on determiner but when I click this one I have high 109 00:09:15,520 --> 00:09:16,300 here. 110 00:09:16,810 --> 00:09:21,400 The number of times I click them the number of times I have high printed here. 111 00:09:21,820 --> 00:09:26,060 So if you don't know the CEO we have that one that one that one. 112 00:09:26,170 --> 00:09:28,170 Now this is about. 113 00:09:28,180 --> 00:09:28,740 Come on. 114 00:09:28,780 --> 00:09:30,210 That's how you can add Dickerman. 115 00:09:30,220 --> 00:09:31,600 And this is how these things work. 116 00:09:31,600 --> 00:09:34,660 Like when I click this one it go down there. 117 00:09:36,110 --> 00:09:39,890 When I click this one this expand the whole window 118 00:09:42,670 --> 00:09:44,120 so the double. 119 00:09:44,120 --> 00:09:44,670 Come on. 120 00:09:44,680 --> 00:09:46,250 The buttons are useless. 121 00:09:46,300 --> 00:09:48,570 So have a clear grip on. 122 00:09:48,580 --> 00:09:50,540 Come on now. 123 00:09:50,710 --> 00:09:52,790 Let me move to other barometers. 124 00:09:52,940 --> 00:10:01,800 Say what if I want my button something a proper interface like when I have my button here. 125 00:10:02,140 --> 00:10:09,000 Then you notice this is something called pressed one behavior button written then near the boundaries 126 00:10:09,010 --> 00:10:10,840 we have the boundary of that button. 127 00:10:10,940 --> 00:10:14,680 Well we can see the walls of the particular button. 128 00:10:15,220 --> 00:10:18,060 So for that we use banks. 129 00:10:18,370 --> 00:10:26,430 Betting is separating the text from the boundaries and that will let me show you him if I use bad X 130 00:10:26,440 --> 00:10:35,930 that is bedding of X and POS here 20 go on us and then add on this one here if you notice I have my 131 00:10:35,930 --> 00:10:38,430 button and there's a gap on x axis on both. 132 00:10:38,440 --> 00:10:48,200 Decide this one 20 picks up and if I need to have bedding on y axis bed y and pass this onesie 50 save 133 00:10:48,200 --> 00:10:49,130 this one. 134 00:10:49,620 --> 00:10:56,840 And now if I've done that one here I had this one button padding or 50 pixel on top and 50 pixel on 135 00:10:56,840 --> 00:10:57,600 bottom. 136 00:10:57,620 --> 00:11:00,130 So this is the padding barometer here. 137 00:11:00,220 --> 00:11:06,470 Also useful one on one meeting them again and again closing this one because until I did not gross that 138 00:11:06,470 --> 00:11:10,390 one here I do not get any option to write and run my commands. 139 00:11:10,430 --> 00:11:12,090 So I need to get that done. 140 00:11:12,100 --> 00:11:15,250 So the declines will turn here. 141 00:11:15,470 --> 00:11:16,500 No one more here. 142 00:11:17,210 --> 00:11:27,870 I need to tell you is the active full grown active and then v use here f for R that is not in default 143 00:11:28,900 --> 00:11:36,780 and then e groaned and that will be you will pass here any color save red save this one and many you 144 00:11:36,780 --> 00:11:45,080 run this one here or that one then whenever you click your button you will have the color change of 145 00:11:45,080 --> 00:11:45,770 text here. 146 00:11:45,830 --> 00:11:50,520 That is something you have also noticed in different buttons whenever you are doing something. 147 00:11:50,930 --> 00:11:56,090 So that is you can how change the color of this text also high is still printing here. 148 00:11:57,740 --> 00:12:03,050 So this is all about the button and I hope you got the idea and how how we can create digits and how 149 00:12:03,050 --> 00:12:09,260 the parameters are created from now we will focus on individuals one by one but we will not go deep 150 00:12:09,260 --> 00:12:14,550 like this because this one I believe give you all the idea that how these things works. 151 00:12:14,690 --> 00:12:21,440 Otherwise they think to modify a very large more than three or four hours so you can do any parameter. 152 00:12:22,490 --> 00:12:28,050 I will just tell you who barometer about these and all day working will be defined here. 153 00:12:28,550 --> 00:12:31,610 So thanks for watching this all about the buttons. 154 00:12:31,610 --> 00:12:33,980 And we will continue in the next video with canvas.