1
00:00:00,470 --> 00:00:03,170
So far, we have developed this program.

2
00:00:03,170 --> 00:00:07,100
We have this ADD button and this added button and this video.

3
00:00:07,100 --> 00:00:14,840
We're going to add a complete button next to the edit button and also an exit button somewhere down

4
00:00:15,260 --> 00:00:17,240
below the list box.

5
00:00:17,240 --> 00:00:17,900
Here.

6
00:00:17,900 --> 00:00:21,290
The complete button will delete the selected.

7
00:00:21,290 --> 00:00:28,970
To do so, we select it to do press complete the to do is deleted from to dos the text and also from

8
00:00:28,970 --> 00:00:33,620
this list box, while the exit button will close the program.

9
00:00:33,620 --> 00:00:37,070
So the exit button will be an addition to this button.

10
00:00:37,070 --> 00:00:40,310
Both that and the exit button will close the program.

11
00:00:40,310 --> 00:00:41,120
Let's begin.

12
00:00:41,130 --> 00:00:42,890
Let's ignore this error for now.

13
00:00:42,890 --> 00:00:45,290
We're going to fix that also later on.

14
00:00:45,290 --> 00:00:47,750
So let's look at the current layout.

15
00:00:47,750 --> 00:00:54,560
We have the label in one row, then we have the input box and the add button in another row.

16
00:00:54,560 --> 00:00:58,970
And then in the third row we have the list box and the edit button.

17
00:00:58,970 --> 00:00:59,450
Here.

18
00:00:59,450 --> 00:01:07,370
We want to also add a complete button in the same row so to the right of the edit button.

19
00:01:07,370 --> 00:01:10,310
So let's create that complete button.

20
00:01:11,660 --> 00:01:16,670
On the edit button, we declare a complete button.

21
00:01:16,670 --> 00:01:19,340
So that is the same variable name as this one.

22
00:01:19,340 --> 00:01:24,380
And this is going to be again, a button with a label complete.

23
00:01:24,530 --> 00:01:31,460
Now, since this line is getting too long, I want to split it into several lines so it would make sense

24
00:01:31,460 --> 00:01:33,920
to have one row in one line.

25
00:01:33,920 --> 00:01:39,080
So we have the label row and then we have this row with the input box and the edit button.

26
00:01:39,080 --> 00:01:42,380
And then after the comma here, I split it again.

27
00:01:42,380 --> 00:01:46,070
So one row, two rows, three rows.

28
00:01:46,490 --> 00:01:48,980
Let's run to see what we have.

29
00:01:49,430 --> 00:01:51,110
Yeah, so it looks fine.

30
00:01:51,200 --> 00:01:53,570
Edit And complete now.

31
00:01:55,850 --> 00:01:59,630
We should add a case complete.

32
00:01:59,630 --> 00:02:01,610
So we have case at we have case.

33
00:02:01,710 --> 00:02:08,060
Edit Let's add a case complete.

34
00:02:08,389 --> 00:02:11,690
So complete is the label of the button.

35
00:02:11,780 --> 00:02:12,650
This one in here.

36
00:02:12,650 --> 00:02:21,650
When the user presses that button, complete that string it's stored in event and this variable in here.

37
00:02:21,740 --> 00:02:24,170
So we match that event.

38
00:02:24,170 --> 00:02:27,620
If the event is complete, what do we want to do?

39
00:02:27,650 --> 00:02:31,670
Well, we want to delete the given item.

40
00:02:31,970 --> 00:02:38,960
So first we want to get the to do to complete, just like we did for edit.

41
00:02:38,960 --> 00:02:45,240
We got to do to edit from values to dos.

42
00:02:45,560 --> 00:02:53,000
So which means that when the user selects, for example, get the core, that dictionary is the values

43
00:02:53,000 --> 00:02:53,630
variable.

44
00:02:53,670 --> 00:03:02,420
So we extract that list out of that and also we extract that string out of that list using zero this

45
00:03:02,420 --> 00:03:03,740
index operation.

46
00:03:03,740 --> 00:03:08,870
And now we want to remove that to do from to dos the text.

47
00:03:08,900 --> 00:03:16,900
So first we get the to dos from to dos the text using functions that get to choose.

48
00:03:16,910 --> 00:03:21,770
This will give us the list of current to dos inside to dos the text.

49
00:03:23,570 --> 00:03:27,350
We're here and then we say to dos that remove.

50
00:03:27,740 --> 00:03:30,320
So we use the remove methods.

51
00:03:30,320 --> 00:03:32,780
It's a list method to do this list.

52
00:03:32,780 --> 00:03:40,700
So to do that remove or removes a to do for example, if we had a is equal to one, two and three and

53
00:03:40,700 --> 00:03:45,320
we say a dot remove three that is going to remove item three.

54
00:03:45,320 --> 00:03:48,260
So a now is updated to that.

55
00:03:48,260 --> 00:03:51,920
It only has one to the first two items.

56
00:03:52,820 --> 00:03:57,560
So we want to remove the two due to complete.

57
00:03:57,860 --> 00:04:02,660
And then once we update the list, we say function.

58
00:04:02,670 --> 00:04:12,230
That's right to dos and we send it to this list to that right to dos function so that the right to this

59
00:04:12,230 --> 00:04:16,490
function writes that list to to dos the text.

60
00:04:17,180 --> 00:04:21,500
And lastly, we want to say window to dos.

61
00:04:21,500 --> 00:04:30,380
So this point to the list box instance, this instance no to that this instance has to do as a key.

62
00:04:30,380 --> 00:04:34,910
So therefore windows to dos points to that list box.

63
00:04:34,910 --> 00:04:37,010
So we want to update the list box.

64
00:04:37,010 --> 00:04:41,300
We want to place a new value for values.

65
00:04:41,300 --> 00:04:44,570
Values is the list of the items.

66
00:04:44,930 --> 00:04:46,940
We want to put a new list.

67
00:04:46,940 --> 00:04:54,080
The new list is to dos the list which is updated from that remove method.

68
00:04:54,740 --> 00:05:03,110
So if I run this now and I try to remove get the car and then I press complete, get the core disappears

69
00:05:03,110 --> 00:05:04,130
from the list box.

70
00:05:04,130 --> 00:05:09,200
However, it is still in the input box because we haven't updated the input box.

71
00:05:09,200 --> 00:05:11,390
So let's update the input box as well.

72
00:05:12,560 --> 00:05:15,470
That is window with the key.

73
00:05:15,470 --> 00:05:18,920
Let's see the input box which is the input text.

74
00:05:18,920 --> 00:05:21,290
I sometimes refer to it as input box.

75
00:05:21,290 --> 00:05:23,120
It has a key to do.

76
00:05:23,120 --> 00:05:27,440
Therefore we say window to do that.

77
00:05:27,440 --> 00:05:28,460
Update.

78
00:05:28,550 --> 00:05:31,640
This has a value argument, not values.

79
00:05:31,640 --> 00:05:36,560
It contains one single value and we want to update it to an empty string.

80
00:05:36,560 --> 00:05:41,060
So just write two single quotes or to double quotes wherever you prefer.

81
00:05:42,380 --> 00:05:42,950
Run.

82
00:05:42,960 --> 00:05:44,330
Go without pi.

83
00:05:44,810 --> 00:05:47,150
Let's remove clean the program.

84
00:05:47,150 --> 00:05:49,580
So complete clean.

85
00:05:49,580 --> 00:05:52,370
The program is removed from the list box.

86
00:05:52,370 --> 00:05:58,430
It's also removed from the input text here and also from to dos the text.

87
00:05:58,460 --> 00:06:00,260
You see, it's not here anymore.

88
00:06:01,100 --> 00:06:03,470
So that was the complete button.

89
00:06:03,470 --> 00:06:06,320
Now let's add an exit button as well.

90
00:06:06,440 --> 00:06:09,650
I said that exit is going to be in a separate line.

91
00:06:09,650 --> 00:06:15,440
Therefore I'll place a comma here in this row and add a new list in here.

92
00:06:15,440 --> 00:06:16,940
So notice the brackets.

93
00:06:16,940 --> 00:06:19,790
We have this bracket which closes in here.

94
00:06:19,790 --> 00:06:22,460
Those are the main out brackets.

95
00:06:22,460 --> 00:06:27,770
And then we have the rows, that one, that row and a third row here.

96
00:06:28,100 --> 00:06:36,590
This is going to be an exit button which should be created in here as that button.

97
00:06:38,010 --> 00:06:39,630
Exit our van.

98
00:06:39,630 --> 00:06:45,090
We go down here to add a case exit.

99
00:06:45,090 --> 00:06:47,060
So that is the label of the button.

100
00:06:47,070 --> 00:06:54,120
So if the user presses exit, exit is going to be stored in the event variable.

101
00:06:54,120 --> 00:06:59,520
So we check if the event is add, edit, complete or exit.

102
00:06:59,520 --> 00:07:01,950
And if it is exit, we break the loop.

103
00:07:02,280 --> 00:07:08,460
So let's try where we have exit, we press exit and the program exits.

104
00:07:10,850 --> 00:07:16,520
If we press this button now, we don't get that error anymore that you saw previously.

105
00:07:16,520 --> 00:07:18,800
So that also fixes that error.

106
00:07:19,550 --> 00:07:23,870
Before we close this video, let's not forget to commit.

107
00:07:24,290 --> 00:07:32,600
So press that button and implement the complete and exit buttons.

108
00:07:32,840 --> 00:07:36,340
You can commit that message if you like.

109
00:07:36,350 --> 00:07:41,840
You can also push the changes if you want to synchronize them with GitHub.

110
00:07:42,110 --> 00:07:49,850
It's fine to push the changes just after a few commits, but this is also fine, especially when you're

111
00:07:49,850 --> 00:07:50,660
learning.

112
00:07:50,810 --> 00:07:53,780
So if you want to push them, just push them on GitHub.

113
00:07:54,060 --> 00:07:55,580
There's no harm done.

114
00:07:55,700 --> 00:07:57,920
So with that, I'll see you in the next video.

115
00:07:57,950 --> 00:07:58,520
Thanks.

