0
1
00:00:04,720 --> 00:00:06,980
<v ->Hello again, we are about to finish our project</v>
1

2
00:00:06,980 --> 00:00:08,870
and in this lesson what I want to do,
2

3
00:00:08,870 --> 00:00:12,917
I want to create this edit menu item,
3

4
00:00:12,917 --> 00:00:14,820
the find item, okay.
4

5
00:00:14,820 --> 00:00:16,700
How can I do that?
5

6
00:00:16,700 --> 00:00:18,640
Let me run our original application first,
6

7
00:00:18,640 --> 00:00:20,600
I want to show you something here.
7

8
00:00:20,600 --> 00:00:24,470
This is the original one and I will paste here text, okay.
8

9
00:00:24,470 --> 00:00:28,504
And now let me say edit and after that find, okay.
9

10
00:00:28,504 --> 00:00:30,830
Let's see how it's working.
10

11
00:00:30,830 --> 00:00:34,000
For example, if I want to find a text here,
11

12
00:00:34,000 --> 00:00:36,260
and I say here 'lorem', okay,
12

13
00:00:36,260 --> 00:00:38,112
and after here find.
13

14
00:00:38,112 --> 00:00:41,650
Now you see our application finds for us
14

15
00:00:41,650 --> 00:00:44,350
all the 'lorem', right, it's the keyword.
15

16
00:00:44,350 --> 00:00:47,700
And what it's doing now, our application,
16

17
00:00:47,700 --> 00:00:51,520
it makes background of text yellow and the front ground
17

18
00:00:51,520 --> 00:00:55,080
of our text we are looking for is red, right.
18

19
00:00:55,080 --> 00:00:56,690
And now also what I can do,
19

20
00:00:56,690 --> 00:00:58,860
I can also replace this text okay.
20

21
00:00:58,860 --> 00:01:03,670
For example, here I will enter a new value for replace
21

22
00:01:03,670 --> 00:01:05,710
and after that I will say replace,
22

23
00:01:05,710 --> 00:01:09,330
now you see we replace ...this text.
23

24
00:01:09,330 --> 00:01:10,930
you see its here,
24

25
00:01:10,930 --> 00:01:14,893
here, and also somewhere here,
25

26
00:01:16,690 --> 00:01:18,110
and so on.
26

27
00:01:18,110 --> 00:01:20,850
I don't know there is still complicated to find them,
27

28
00:01:20,850 --> 00:01:23,928
but you understand how it's working right.
28

29
00:01:23,928 --> 00:01:28,928
Now we are going to create this find window, okay.
29

30
00:01:28,960 --> 00:01:31,780
Here what I need to do, to do that actually I will
30

31
00:01:31,780 --> 00:01:35,050
create a new class to do that, okay.
31

32
00:01:35,050 --> 00:01:36,913
And here, how can I do that,
32

33
00:01:38,933 --> 00:01:40,830
I will come here, okay.
33

34
00:01:40,830 --> 00:01:45,510
The top of my page, and here I will create a new class
34

35
00:01:45,510 --> 00:01:47,410
and I will say class FindDialog, okay.
35

36
00:01:50,360 --> 00:01:55,360
Here I will inherit this class from Toplevel window okay,
36

37
00:01:55,880 --> 00:01:57,920
and after here what I need to do,
37

38
00:01:57,920 --> 00:02:02,520
I need to say def__init, like before okay.
38

39
00:02:08,040 --> 00:02:11,550
And after here, I'm going to create my parameters,
39

40
00:02:11,550 --> 00:02:14,750
but simply I can copy these guys
40

41
00:02:16,310 --> 00:02:20,450
and paste them here, okay.
41

42
00:02:20,450 --> 00:02:24,673
Also what I need to do, I need to copy these guys right,
42

43
00:02:26,110 --> 00:02:30,640
here and paste them here again.
43

44
00:02:30,640 --> 00:02:32,960
But instead of Menu, what you need to do,
44

45
00:02:32,960 --> 00:02:35,890
I need to say here Toplevel, okay,
45

46
00:02:35,890 --> 00:02:39,260
and after that what I need to do, I need to define here
46

47
00:02:39,260 --> 00:02:44,090
geometry from my self.geometry
47

48
00:02:45,800 --> 00:02:47,320
for my window, okay.
48

49
00:02:47,320 --> 00:02:48,930
And here I will say
49

50
00:02:48,930 --> 00:02:51,080
450x200+550+200
50

51
00:02:57,510 --> 00:03:01,173
and also I want to set a title for my window,
51

52
00:03:02,107 --> 00:03:04,730
self.title, right.
52

53
00:03:04,730 --> 00:03:07,663
And for title I will say Find,
53

54
00:03:08,716 --> 00:03:10,820
and also I want to say
54

55
00:03:12,175 --> 00:03:15,925
self.resizable(False,False).
55

56
00:03:23,940 --> 00:03:26,720
Now what I need to do, I need to create my design
56

57
00:03:26,720 --> 00:03:28,150
for this window,
57

58
00:03:28,150 --> 00:03:29,691
and here what I need to do,
58

59
00:03:29,691 --> 00:03:32,274
I will create here labels okay.
59

60
00:03:33,464 --> 00:03:34,797
First I will say
60

61
00:03:36,378 --> 00:03:37,211
txtFind,
61

62
00:03:38,865 --> 00:03:42,846
or label Find, it doesn't matter, here I will say
62

63
00:03:42,846 --> 00:03:47,846
txtFind=Label(self,text="Find: ")
63

64
00:04:03,429 --> 00:04:06,153
And after that what I want to do,
64

65
00:04:06,153 --> 00:04:09,269
here I need to say txtfind.place
65

66
00:04:09,269 --> 00:04:13,510
I will use place.geomtry manager for this window
66

67
00:04:13,510 --> 00:04:16,760
(x=20,y=20).
67

68
00:04:19,668 --> 00:04:21,676
And after here what I need to do, I need to create
68

69
00:04:21,676 --> 00:04:24,093
another txtReplace=Label
69

70
00:04:31,103 --> 00:04:34,936
(self,text="Replace :").
70

71
00:04:43,058 --> 00:04:45,011
For the Replace also I am going to use
71

72
00:04:45,011 --> 00:04:46,844
place.geometry manager
72

73
00:04:48,817 --> 00:04:53,400
txtReplace.place(x=20,y=60).
73

74
00:05:04,789 --> 00:05:06,267
After that what I need to do also,
74

75
00:05:06,267 --> 00:05:08,329
I need to create here two entries, okay,
75

76
00:05:08,329 --> 00:05:10,739
the first one is for finding,
76

77
00:05:10,739 --> 00:05:12,561
and the other one is for replacement.
77

78
00:05:12,561 --> 00:05:14,320
So I will say here
78

79
00:05:14,320 --> 00:05:19,320
self.findInput=Entry(self,width=30).
79

80
00:05:30,864 --> 00:05:34,654
Now what I will do, I will press Ctrl+D, okay,
80

81
00:05:34,654 --> 00:05:37,440
and here I will say, for second guy I will say,
81

82
00:05:37,440 --> 00:05:42,440
self.replaceInput=Entry(self,width=30).
82

83
00:05:47,803 --> 00:05:50,567
Now what I need to do, I need to use place.geomtry
83

84
00:05:50,567 --> 00:05:52,039
for these guys
84

85
00:05:52,039 --> 00:05:57,039
self.findInput.place(x=100,y=20).
85

86
00:06:05,084 --> 00:06:07,381
Again Ctrl+D,
86

87
00:06:07,381 --> 00:06:12,381
for self.replaceInput.place(x=100,y=60).
87

88
00:06:18,230 --> 00:06:19,282
After that what I need to do,
88

89
00:06:19,282 --> 00:06:21,842
remember also we need two buttons, right.
89

90
00:06:21,842 --> 00:06:23,810
The first one is Find button, and the second one
90

91
00:06:23,810 --> 00:06:26,889
will be Replace button, so I will say here
91

92
00:06:26,889 --> 00:06:31,889
self.btnFind=Button(self,text="Find").
92

93
00:06:42,227 --> 00:06:43,977
And here for Command,
93

94
00:06:45,335 --> 00:06:49,002
actually we can create Command now or later,
94

95
00:06:50,615 --> 00:06:53,800
let's create them later okay, not now.
95

96
00:06:53,800 --> 00:06:57,562
And here also I will press Ctrl+D again
96

97
00:06:57,562 --> 00:07:02,562
self.btnReplace=Button(self,text="Replace"),
97

98
00:07:10,003 --> 00:07:12,990
I am going to use geometry manager for these guys right.
98

99
00:07:12,990 --> 00:07:16,137
And here I will say self.btnFind.place(x=200,y=90).
99

100
00:07:27,873 --> 00:07:29,456
Again, Ctrl+D,
100

101
00:07:32,372 --> 00:07:37,372
self.btnReplace.place(x=240,y=90).
101

102
00:07:40,899 --> 00:07:44,151
We've created our class now, so what I need to do now,
102

103
00:07:44,151 --> 00:07:46,604
I need to go to Main Menu, okay,
103

104
00:07:46,604 --> 00:07:49,754
and here Find is somewhere here right,
104

105
00:07:49,754 --> 00:07:52,328
File Edit, and Find is here.
105

106
00:07:52,328 --> 00:07:54,730
So I need to create here Command property,
106

107
00:07:54,730 --> 00:07:57,230
command=self.parent.find)
107

108
00:08:02,235 --> 00:08:04,845
So what I will do now, I will go to create
108

109
00:08:04,845 --> 00:08:07,262
this function here somewhere.
109

110
00:08:09,159 --> 00:08:11,826
Let's go to the end of our code,
110

111
00:08:13,540 --> 00:08:16,623
it's here right, and I will say here,
111

112
00:08:18,073 --> 00:08:21,632
def_find, okay, and here what I need to say,
112

113
00:08:21,632 --> 00:08:26,382
I need to say (self,*args):_ like before
113

114
00:08:27,430 --> 00:08:31,041
And here what I will use, now I need to create
114

115
00:08:31,041 --> 00:08:33,990
a new object from my class,
115

116
00:08:33,990 --> 00:08:35,131
so how I can do that,
116

117
00:08:35,131 --> 00:08:37,406
I will say self.find,
117

118
00:08:37,406 --> 00:08:40,573
this my class, this is my object name,
118

119
00:08:42,981 --> 00:08:45,231
=find, sorry not find.
119

120
00:08:47,324 --> 00:08:50,157
(mouse scrolling)
120

121
00:08:51,250 --> 00:08:54,165
Our class name is FindDialog right,
121

122
00:08:54,165 --> 00:08:55,927
so what I need to do,
122

123
00:08:55,927 --> 00:08:57,427
I need to use here
123

124
00:08:59,799 --> 00:09:01,307
FindDialog.
124

125
00:09:01,307 --> 00:09:06,307
And here I will say (self=parent)
125

126
00:09:07,291 --> 00:09:09,791
Now if I run my application...
126

127
00:09:12,241 --> 00:09:15,074
(mouse clicking)
127

128
00:09:16,621 --> 00:09:17,954
Here, Edit Find,
128

129
00:09:20,778 --> 00:09:23,046
FindDialog(self=parent) is not defined it said,
129

130
00:09:23,046 --> 00:09:27,213
so why its like that, let me check now.
130

131
00:09:30,473 --> 00:09:33,537
self.find=FindDialog(parent=self).
131

132
00:09:36,645 --> 00:09:39,093
So let's remove this, I need to say (parent=self).
132

133
00:09:41,255 --> 00:09:42,553
Sorry, not (self=parent), (parent=self).
133

134
00:09:45,790 --> 00:09:48,880
Okay, I will say (parent=self), now it will be fine.
134

135
00:09:48,880 --> 00:09:50,053
Run it again.
135

136
00:09:51,530 --> 00:09:54,540
Now here our application with Find,
136

137
00:09:54,540 --> 00:09:56,710
you see our Find dialog is here,
137

138
00:09:56,710 --> 00:10:00,040
so we used here Find Replace texts,
138

139
00:10:00,040 --> 00:10:01,770
two entries, two buttons.
139

140
00:10:01,770 --> 00:10:06,060
And also we used place geometry manager to place our widgets.
140

141
00:10:06,060 --> 00:10:08,510
And in this lesson we create our design
141

142
00:10:08,510 --> 00:10:10,680
for this dialog window,
142

143
00:10:10,680 --> 00:10:11,907
and in next lesson what we are going to do,
143

144
00:10:11,907 --> 00:10:15,470
we are going to create our function for this window.
144

145
00:10:15,470 --> 00:10:17,470
For now that's all, see you in the next.
