1
00:00:00,660 --> 00:00:07,500
Hello, everyone, and the last video I have shown you how you can create a button and do some editing

2
00:00:07,500 --> 00:00:07,840
on it.

3
00:00:08,280 --> 00:00:17,640
Now I will show you how you can add or create a function that will be executed when we click the button.

4
00:00:17,940 --> 00:00:24,240
So, for example, if we want that, when we click here, when we click the button, we will see a label

5
00:00:24,240 --> 00:00:25,040
or a text here.

6
00:00:25,560 --> 00:00:28,530
So we need to add a function that will do this work.

7
00:00:29,280 --> 00:00:35,010
So before that, I have a notes I want to tell you about the bad X and by the way, it functions.

8
00:00:35,460 --> 00:00:44,580
So if we write this functions inside the the button function, which is when we are creating the button,

9
00:00:45,360 --> 00:00:50,690
it it is not the same thing if we write these functions in the back.

10
00:00:51,060 --> 00:00:51,450
Why?

11
00:00:51,450 --> 00:00:59,940
Because here in the in the in the bottom function, if we write for example here but X equal duty and

12
00:00:59,940 --> 00:01:07,080
Budhwar equals money, that means that we will make a space between the text here, the text and the

13
00:01:07,090 --> 00:01:08,420
border of the button.

14
00:01:08,820 --> 00:01:11,220
The same thing for the for the labels.

15
00:01:11,220 --> 00:01:18,900
If we have a label and we, we put the X and by the way, inside or in the creation of the button or

16
00:01:18,900 --> 00:01:25,080
the label, that means that we will make a space between the text and the border of the button or the

17
00:01:25,080 --> 00:01:32,070
label, which means for that I told you that we will have the the width and the height of the button

18
00:01:32,070 --> 00:01:35,630
when we control it with with the button and by the way.

19
00:01:35,910 --> 00:01:42,780
But if we want to make a space between the button and the border of the window, for example, we want

20
00:01:42,780 --> 00:01:44,080
to move it down, for example.

21
00:01:44,430 --> 00:01:51,810
So in this case, we will use the the functions, the putting functions inside the back function.

22
00:01:52,080 --> 00:02:00,510
So here in the back, if we will, if we want, for example, we make pad Y equals 20, for example,

23
00:02:00,900 --> 00:02:08,490
we will see here that we have some space between the button and the border of the window, because if

24
00:02:08,490 --> 00:02:16,020
we use the padding in the back function, we will control the items between, for example, if we have

25
00:02:16,020 --> 00:02:21,710
two items that we will make a space between these two, these two two items.

26
00:02:22,050 --> 00:02:27,450
But if we have just one item in this case, we will make a space between the item and the border of

27
00:02:27,450 --> 00:02:27,930
the window.

28
00:02:28,570 --> 00:02:29,760
Same thing for the pathway.

29
00:02:30,060 --> 00:02:38,370
But so if we write if we use the padding functions in the back here, we will make a space between the

30
00:02:38,400 --> 00:02:44,070
items or between the item and boarded the windows, the window by voters.

31
00:02:44,490 --> 00:02:51,710
But if we will, we will use the building functions in the creation of the button or labor.

32
00:02:52,560 --> 00:03:00,300
In this case, we will make a space between the text and the borders, or we can say we will control

33
00:03:00,300 --> 00:03:03,280
the width and the height of this items.

34
00:03:04,160 --> 00:03:13,810
So we will will back to our main subject, which is how to create a function or a command for this button.

35
00:03:14,130 --> 00:03:21,000
So as I told you, we want if we click on this button, we will have a text saying, for example, hi,

36
00:03:21,000 --> 00:03:21,690
how are you today?

37
00:03:22,410 --> 00:03:25,680
So in this case, we will use the function called command.

38
00:03:26,640 --> 00:03:29,640
This function will execute this function.

39
00:03:29,640 --> 00:03:33,180
Command will execute the function that will write this text.

40
00:03:33,360 --> 00:03:40,150
So we will write, for example, come on then one after that we will write the name of the function.

41
00:03:40,170 --> 00:03:43,160
So for example, make it click for the moment.

42
00:03:43,170 --> 00:03:50,700
I didn't define the function yet, but I will just write the name of the function, which is click.

43
00:03:50,850 --> 00:03:53,740
After that, I will define it in the beginning of the program.

44
00:03:54,240 --> 00:04:01,050
So as you can see here, we didn't push the buttons, but we know that in the programming, if we call

45
00:04:01,050 --> 00:04:05,730
any function, we need to add the parentheses so that we will say that this is a function.

46
00:04:05,970 --> 00:04:11,440
But in this case, we don't need it, because if we like this, just like this, come on, that equal

47
00:04:11,460 --> 00:04:12,690
the name of the function.

48
00:04:13,260 --> 00:04:15,740
We can't use the function with parameters.

49
00:04:15,750 --> 00:04:16,410
In this case.

50
00:04:16,500 --> 00:04:22,560
There is there is another case that we can use the parameters, but in this case we can't use parameters

51
00:04:22,770 --> 00:04:25,410
so that we can't write the buttons.

52
00:04:25,500 --> 00:04:27,970
So we write just the name of the function and it will.

53
00:04:28,710 --> 00:04:34,010
So here we like the function that function, the click function, for example.

54
00:04:34,020 --> 00:04:38,750
So def click But this is the columns.

55
00:04:39,360 --> 00:04:45,390
So I told you that we want if we click on this button we will have a text.

56
00:04:45,570 --> 00:04:52,230
So inside this function we will create our label because if we write the label outside, this function

57
00:04:52,230 --> 00:04:59,850
means that when we run our program it will create the label without waiting for the click or something

58
00:04:59,850 --> 00:04:59,940
like.

59
00:05:00,390 --> 00:05:08,820
So if you wanted to to be printed or to be created after clicking on the button, so we need you to

60
00:05:08,820 --> 00:05:14,430
create it inside the creation or inside the function that will be pressed.

61
00:05:14,640 --> 00:05:24,430
OK, so we give this label a name, for example, love, equal label labor and then parentheses.

62
00:05:24,720 --> 00:05:27,590
We will make this label in the roots.

63
00:05:28,260 --> 00:05:33,120
Then the text equals

64
00:05:35,730 --> 00:05:41,320
the word, you know, to today.

65
00:05:41,670 --> 00:05:43,770
So when we press, we want that.

66
00:05:43,770 --> 00:05:45,880
When we press the button, we will see this text.

67
00:05:45,900 --> 00:05:46,590
Hi, Howard.

68
00:05:46,740 --> 00:05:47,150
Hi there.

69
00:05:47,160 --> 00:05:47,710
How are you doing?

70
00:05:48,180 --> 00:05:50,460
So this is the text we make somebody think on.

71
00:05:50,460 --> 00:05:52,060
It really was what we learned before.

72
00:05:52,440 --> 00:05:57,710
So here we will use phones before that.

73
00:05:58,190 --> 00:06:01,890
OK, phones, sorry.

74
00:06:02,670 --> 00:06:10,020
Then we use the left who will make it to 20.

75
00:06:11,160 --> 00:06:13,920
Then we do some padding.

76
00:06:15,150 --> 00:06:22,380
But to to give you a difference between putting the padding function in the in the creation and in the

77
00:06:22,380 --> 00:06:22,700
back.

78
00:06:22,980 --> 00:06:33,480
So here but X equals we put it to ten then that Y equals ten.

79
00:06:34,710 --> 00:06:37,580
Then after that we will back this label.

80
00:06:37,590 --> 00:06:46,320
So Lub points back and here we will do some padding in the way.

81
00:06:46,800 --> 00:06:50,670
So by the way equals for example, we put a twin.

82
00:06:51,480 --> 00:06:58,260
So in this case, when we press the button, which is this, this button, click me.

83
00:06:58,710 --> 00:07:02,010
When we press it, we will see this label.

84
00:07:02,550 --> 00:07:04,260
So we will see if it works.

85
00:07:04,290 --> 00:07:06,300
So here our button.

86
00:07:06,420 --> 00:07:11,280
If we click here, we will see either our each day, if we like another time, we will see the same

87
00:07:11,280 --> 00:07:11,490
thing.

88
00:07:11,670 --> 00:07:12,740
OK, as you can see.

89
00:07:13,530 --> 00:07:21,270
So in this program, we we just we just added a function which is click this function, click.

90
00:07:21,510 --> 00:07:24,130
We inside this function really create a label.

91
00:07:24,390 --> 00:07:31,640
So in every time we click the button, it we call this function and it will create a new label.

92
00:07:32,340 --> 00:07:34,260
So it was all for today.

93
00:07:34,530 --> 00:07:38,310
And I see you in the next video and stay safe by.
