1
00:00:00,600 --> 00:00:02,620
Hello, everyone, in this video.

2
00:00:02,640 --> 00:00:08,190
We start putting the core of each function function in this case, we have just two functions.

3
00:00:08,190 --> 00:00:12,490
So we put the core of each function actually for this function.

4
00:00:12,510 --> 00:00:15,270
For example, we have already the core, which is this one.

5
00:00:16,840 --> 00:00:21,010
Which is this one, this is the core of that function, because the function that will talk is this

6
00:00:21,010 --> 00:00:26,980
one which will take the PDAF and convert it to a text and after that, convert it to you and say it.

7
00:00:27,460 --> 00:00:34,240
So what we need just what we have to change in this front, in this part, which is this call that we

8
00:00:34,240 --> 00:00:41,320
will put in that function, is the path because this function or this part works just with one part,

9
00:00:41,320 --> 00:00:43,440
which is this one book point Bedier.

10
00:00:43,810 --> 00:00:52,360
But if we want to because we want what we want to create a program or a application that will open and

11
00:00:52,990 --> 00:00:54,450
convert any idea.

12
00:00:54,460 --> 00:01:00,610
Which means, for example, if today I want to listen to a book or tomorrow I want to listen to another

13
00:01:00,610 --> 00:01:00,790
one.

14
00:01:01,000 --> 00:01:06,940
So in this case, I don't want to go in each time and go here and take the path or something like that.

15
00:01:07,270 --> 00:01:15,760
But I want that because for that we push the button open that will go and take the path of the video

16
00:01:15,760 --> 00:01:18,820
that we want to listen and put it here in our program.

17
00:01:19,240 --> 00:01:25,470
So as you can see here, this part is the part of is the core of this function, which is.

18
00:01:26,080 --> 00:01:28,020
But before that, we have to return the path.

19
00:01:28,240 --> 00:01:36,660
So we will do that using this this class, which is all disclosed, which include included in interlibrary.

20
00:01:37,030 --> 00:01:40,680
So this dialogue will help us to open a file dialogue.

21
00:01:40,900 --> 00:01:48,790
And after that, we will choose a file and that function will return the path of that PDAF or something

22
00:01:48,790 --> 00:01:49,110
like that.

23
00:01:49,220 --> 00:01:50,890
We do it step by step.

24
00:01:50,920 --> 00:01:51,760
Don't worry about it.

25
00:01:52,210 --> 00:01:56,560
Now, here we have to declare a path, but we have to put it as global.

26
00:01:56,680 --> 00:01:57,070
Why?

27
00:01:57,080 --> 00:02:05,360
Because if we would put a just a variable inside, this function means that this variable is defined

28
00:02:05,380 --> 00:02:06,300
in this function.

29
00:02:06,310 --> 00:02:15,880
But if we want to use it or if we want users in another function or another space, I don't know, for

30
00:02:15,880 --> 00:02:21,280
example, if we want to use in this script or something like this, this path or this variable will

31
00:02:21,280 --> 00:02:22,530
not be defined.

32
00:02:22,720 --> 00:02:25,170
So because it is just for that function.

33
00:02:25,180 --> 00:02:32,080
But if we want to if we created as a global variable in this case, it will be a it will be defined

34
00:02:32,080 --> 00:02:34,010
in any function or any script.

35
00:02:34,270 --> 00:02:37,200
So here is the name Gload.

36
00:02:37,220 --> 00:02:40,600
The will give it to Global, then here we give it the name.

37
00:02:40,600 --> 00:02:43,510
But and before that I want to initialize it.

38
00:02:43,510 --> 00:02:49,260
But we don't want we don't want to initialize inside the function because if we don't if we don't call

39
00:02:49,280 --> 00:02:52,000
the function, the Hollywood will not be initialized.

40
00:02:52,210 --> 00:02:56,240
So we have to initialize is out of the function.

41
00:02:56,260 --> 00:02:58,270
So here we have path equals one.

42
00:02:58,630 --> 00:03:02,680
That means that it is empty, that it has nothing value.

43
00:03:03,250 --> 00:03:11,020
So here after an issue, after creating an initializing the variable, we have to put the right value

44
00:03:11,020 --> 00:03:11,430
on it.

45
00:03:11,440 --> 00:03:19,930
So here we have both a call file dialogue that ask for open filename.

46
00:03:19,940 --> 00:03:26,180
So this function as open filename will open for us a file dialogue.

47
00:03:26,200 --> 00:03:29,170
So after this file dialogue, we can choose any file we want.

48
00:03:29,470 --> 00:03:35,050
Then all this line will return the path of the file chosen.

49
00:03:35,350 --> 00:03:40,070
So in this case, we will return the path of the PDF chosen or the video that we want to see.

50
00:03:40,480 --> 00:03:42,850
So now it is OK for this function.

51
00:03:42,850 --> 00:03:44,530
We do not need to add anything.

52
00:03:44,530 --> 00:03:48,170
We will just save it and see how it looks here.

53
00:03:48,430 --> 00:03:49,450
Here, our application.

54
00:03:49,450 --> 00:03:54,460
If I click in open, you can see that it will open three.

55
00:03:56,980 --> 00:03:58,450
That is a problem here.

56
00:03:59,410 --> 00:04:01,360
But here and open.

57
00:04:03,120 --> 00:04:04,710
We're on again.

58
00:04:14,330 --> 00:04:15,850
What it is not working.

59
00:04:17,280 --> 00:04:24,650
But sorry, I forget, I always do that because this one is a function, so if I don't add the parts,

60
00:04:24,660 --> 00:04:26,940
it will not recognize that it is function.

61
00:04:27,180 --> 00:04:28,180
So we have to add it.

62
00:04:28,710 --> 00:04:31,340
Now, I have this one.

63
00:04:31,350 --> 00:04:33,510
I have to close it to open the new one.

64
00:04:33,530 --> 00:04:38,810
So this one here, if I open it, will open for us this final.

65
00:04:38,810 --> 00:04:41,160
And also we can choose any file we want.

66
00:04:41,190 --> 00:04:43,050
So for example, this video that we want.

67
00:04:43,080 --> 00:04:46,620
So if I click on it two times, it will open it.

68
00:04:46,800 --> 00:04:50,580
But for this moment we can't see it because we didn't do anything with us.

69
00:04:50,910 --> 00:04:55,980
But if we want to see how it looks, will just print it.

70
00:04:56,010 --> 00:05:02,670
So here I will print this path so we'll see what this function will return.

71
00:05:03,180 --> 00:05:06,900
Now is an open book.

72
00:05:07,110 --> 00:05:08,250
As you can see here.

73
00:05:08,500 --> 00:05:09,990
This is my PC down here.

74
00:05:09,990 --> 00:05:16,170
We have the document and audio, that audio book, then the name of the PDA, which is book that PDA.

75
00:05:16,200 --> 00:05:20,490
OK, so this is that's what we what this function returns.

76
00:05:20,730 --> 00:05:22,940
So I would just close this one.

77
00:05:22,950 --> 00:05:28,250
Now, what we have to do, we have to use this parts for our program, which is this one.

78
00:05:28,440 --> 00:05:38,610
So we just take this one here, come and see or see if you are in windows, then we'll post it here.

79
00:05:39,480 --> 00:05:44,480
We have to watch the space, which will be in the core of the function.

80
00:05:44,670 --> 00:05:51,630
OK, so now as you can see, we have always this this part or this constant part, but we want to make

81
00:05:51,630 --> 00:05:55,490
it possible for each file or for each file choose it.

82
00:05:55,740 --> 00:06:00,010
So what we need to do is to it to push the path here.

83
00:06:00,360 --> 00:06:04,850
Now we have this one, but and this is the volume.

84
00:06:05,010 --> 00:06:07,440
So we will try it and we will see how it looks.

85
00:06:07,470 --> 00:06:09,750
There is some changes that we need to do for that.

86
00:06:09,760 --> 00:06:14,970
I will just run to see how it looks and how it works, but after that we will change it.

87
00:06:15,000 --> 00:06:16,710
So here I would click in Open.

88
00:06:18,000 --> 00:06:25,950
I will take this, for example, at 8:00 told, as you can see, we can't we can see nothing for the

89
00:06:25,950 --> 00:06:28,850
moment because we didn't initialised our path.

90
00:06:29,010 --> 00:06:35,400
So there is another problem because we didn't add the other functions as we speak, because here we

91
00:06:35,400 --> 00:06:40,800
have speak that say, but we need to add the function that we that will run this speaker.

92
00:06:40,840 --> 00:06:46,840
So here we have speaker that on this one function.

93
00:06:46,860 --> 00:06:49,920
Now you will see that it will work like this here.

94
00:06:49,920 --> 00:06:59,490
If I will open the PDF book like this and talk abstract three, it follows on resources or some form

95
00:06:59,490 --> 00:07:02,460
of health care rationing is that we choose an unavoidable.

96
00:07:02,910 --> 00:07:03,850
This implies that.

97
00:07:04,440 --> 00:07:05,680
Just stop it for a moment.

98
00:07:05,970 --> 00:07:07,320
Now, as you can see, it works.

99
00:07:07,320 --> 00:07:08,390
But there is a problem.

100
00:07:08,400 --> 00:07:14,750
For example, if we do not click in this button, which means if we don't choose any bedier, so this

101
00:07:14,760 --> 00:07:20,970
function, what what does it have for Abath or as a file, it has nothing because this part is empty

102
00:07:21,240 --> 00:07:22,620
and it will give us an error.

103
00:07:22,650 --> 00:07:29,640
We do it here so that you can see if I don't click it open, which means if I don't choose anybody,

104
00:07:29,640 --> 00:07:34,260
if I will just click on talk so we will see that we will have a problem here, if I will.

105
00:07:34,530 --> 00:07:44,190
In turn, we have an error here because that type, that variable path doesn't have has the value empty,

106
00:07:44,220 --> 00:07:45,950
which is not, in other words.

107
00:07:46,230 --> 00:07:51,850
So that is we don't know, we don't have any path that has the value or not.

108
00:07:52,170 --> 00:08:00,870
So in this case, we have to add a statement to see if the value of path is empty or not.

109
00:08:00,900 --> 00:08:05,730
So if the value of a path is empty, we don't want to run this program.

110
00:08:05,730 --> 00:08:07,490
So we don't want to have any errors.

111
00:08:07,830 --> 00:08:12,460
But if the the path has a value in this case, we want to run it.

112
00:08:12,690 --> 00:08:15,150
So to do this, we have just to take.

113
00:08:16,380 --> 00:08:19,320
All this here, sorry.

114
00:08:22,520 --> 00:08:28,250
Just here, come on, X, then we will add if.

115
00:08:30,650 --> 00:08:36,080
And that's it, because we can write it but equal three equal to sorry or something like this.

116
00:08:36,080 --> 00:08:41,090
But the easiest way is if passed, which means if that is true, if we write it just like this, if

117
00:08:41,120 --> 00:08:47,180
but if the part is not empty or something like this, then here we will put our program.

118
00:08:47,870 --> 00:08:51,140
Now we need to make space here.

119
00:08:52,750 --> 00:08:55,030
You like this now?

120
00:08:55,040 --> 00:09:04,130
Once we have to do if we were on our program, I will show you here, not if I will talk without clicking

121
00:09:04,130 --> 00:09:04,880
on this button.

122
00:09:04,880 --> 00:09:06,860
You can see that there is no error here.

123
00:09:07,100 --> 00:09:13,610
But if I click and open in this case, I can choose an immediate and total abstract three abstract.

124
00:09:13,610 --> 00:09:18,890
It follows from resource scarcity that some form of health care rationing is unavoidable.

125
00:09:19,500 --> 00:09:23,510
OK, as you can see here, this is the program that was it is great.

126
00:09:23,510 --> 00:09:28,430
But there is something that we didn't talk about that we didn't add actually.

127
00:09:28,880 --> 00:09:35,270
So which is the page gets page because in this case it will always take the page number six.

128
00:09:35,750 --> 00:09:42,010
We had we had add that we have the right to change any book we want, but we have always the page six.

129
00:09:42,020 --> 00:09:49,260
But if I want to make even the number of the page variable, which means in every time I want to read

130
00:09:49,280 --> 00:09:53,030
a book, for example, I want to be the first page or second page, etc..

131
00:09:53,450 --> 00:09:59,240
So in this case, I have always to put the name or the number of this page that I want.

132
00:09:59,960 --> 00:10:03,860
So for us, we had we we added this entry.

133
00:10:03,860 --> 00:10:04,530
Where is it?

134
00:10:04,670 --> 00:10:05,880
Smokes books.

135
00:10:07,970 --> 00:10:14,930
This one, this one titled those books Beige Book, sorry, so this entry will take the number of pages

136
00:10:14,930 --> 00:10:16,130
because here we have.

137
00:10:17,720 --> 00:10:24,700
The application here had applications, so this entry will take that number of pages that we want,

138
00:10:24,920 --> 00:10:31,310
so we will take or we will get the text or the number that we have in this entry and we put it in our

139
00:10:31,310 --> 00:10:34,600
function and you will see that it is easy to do that here.

140
00:10:34,610 --> 00:10:35,930
We have to take it.

141
00:10:35,960 --> 00:10:46,460
So here we have a page and I will give it and page for page number, then here, then here.

142
00:10:46,460 --> 00:10:47,270
We will give it.

143
00:10:47,300 --> 00:10:48,110
We will take it.

144
00:10:48,110 --> 00:10:50,480
Or we will get the number that we have in that page.

145
00:10:50,780 --> 00:10:54,920
So here what we have the engineer, which is page number of books.

146
00:10:54,950 --> 00:10:58,380
That's one that gets this one.

147
00:10:58,400 --> 00:11:03,700
So this very page page and will get the name from that entry.

148
00:11:03,830 --> 00:11:11,030
So but then we will have the same problem if we don't write any number of or if we don't choose any

149
00:11:11,030 --> 00:11:11,990
page of the book.

150
00:11:12,260 --> 00:11:14,840
In this case, there is nothing to do.

151
00:11:14,840 --> 00:11:18,380
So in this case, we have to put a here.

152
00:11:18,380 --> 00:11:24,560
We have to add it in the condition, which means if there is no type or there is no number of the page

153
00:11:24,560 --> 00:11:30,980
in this case, we can't run anything because we didn't choose or we didn't we didn't choose or take

154
00:11:31,200 --> 00:11:35,120
or not is the name or the number of the page that we want to read.

155
00:11:35,450 --> 00:11:43,200
So here we have to put and which means if the path is true and if the page number is defined.

156
00:11:43,220 --> 00:11:52,100
So if we have chosen the path and we have chosen the page of the we have chosen the number of the pages

157
00:11:52,100 --> 00:11:56,110
that we want to listen or to read, in this case, you can run this program.

158
00:11:56,120 --> 00:11:58,670
But here we have six discussions.

159
00:11:58,670 --> 00:12:03,230
But we know that we want to put is variable, which is Page and this one.

160
00:12:03,470 --> 00:12:09,860
So in this case, in every time we post the number of the page in that entry, it will take it and see

161
00:12:09,860 --> 00:12:12,580
the condition if this is true.

162
00:12:12,920 --> 00:12:15,820
But if I will run it just like this, we will have a problem.

163
00:12:15,830 --> 00:12:18,060
I will show you how it will look.

164
00:12:18,590 --> 00:12:22,030
I am just doing this so that you can see the problem.

165
00:12:22,040 --> 00:12:27,850
Maybe you are not a programmer and you don't need this, but sorry, I just want to give you all the

166
00:12:28,370 --> 00:12:34,070
the weight or all the errors or something like these issues that you can find so that if you are doing

167
00:12:34,070 --> 00:12:39,740
your program and you will find some issues in some or sometimes in this case, you will know what is

168
00:12:39,740 --> 00:12:40,480
the problem is.

169
00:12:40,820 --> 00:12:47,120
OK, so here if I will just open I will open the PDF like this, this one.

170
00:12:47,510 --> 00:12:52,370
And if I will put here, it will it will.

171
00:12:52,370 --> 00:12:53,180
It will talk.

172
00:12:53,180 --> 00:12:53,800
It won't talk.

173
00:12:53,810 --> 00:13:01,520
Sorry for the talk, it won't talk as you can see because we didn't find any name of we didn't define

174
00:13:01,520 --> 00:13:04,470
the the number of page here.

175
00:13:04,530 --> 00:13:13,370
OK, because here as you can see we had a page and read file and here we have this page, but we didn't

176
00:13:13,370 --> 00:13:16,220
give it the number of the page so that it can tell.

177
00:13:16,310 --> 00:13:19,970
It can't read because what we did was we didn't give it the page.

178
00:13:20,270 --> 00:13:22,820
But the error will be in this step.

179
00:13:23,120 --> 00:13:29,600
For example, if I will give you the basics at the same page as we had before, if if we see that you

180
00:13:29,600 --> 00:13:33,590
can you can say that, yes, there is the number six and it will talk.

181
00:13:33,600 --> 00:13:35,360
So I will open it again.

182
00:13:35,360 --> 00:13:39,850
For example, I will open this book is already opened, but I just want to do it again.

183
00:13:40,070 --> 00:13:43,940
Now, if I click in, Turkey will see that there is an error here, here.

184
00:13:44,810 --> 00:13:46,000
So this error.

185
00:13:46,010 --> 00:13:46,520
Why?

186
00:13:46,520 --> 00:13:53,870
Because the entry will return a stream variable, which means we can see that it is six, it is a number,

187
00:13:54,080 --> 00:13:56,630
but the type of the six is a string.

188
00:13:56,930 --> 00:14:04,100
But this function doesn't take the strings but take the and the integral integer.

189
00:14:04,100 --> 00:14:04,450
Sorry.

190
00:14:04,670 --> 00:14:10,900
So we have to convert this variable from the string to integer and it is easy.

191
00:14:10,910 --> 00:14:12,840
I will just close this one for the moment.

192
00:14:13,490 --> 00:14:23,240
Now what we have to do, we have to click and then like this that says we have to convert the that image

193
00:14:23,240 --> 00:14:28,510
also does not image that variable or that number from a string to another.

194
00:14:28,520 --> 00:14:29,690
And now it will work.

195
00:14:29,690 --> 00:14:37,610
You will see we do it again here, for example, we give it six and I will open the book, this one

196
00:14:37,790 --> 00:14:40,340
then here, abstract, very abstract.

197
00:14:40,340 --> 00:14:43,340
It follows from resource scarcity at some form of health care.

198
00:14:43,340 --> 00:14:45,910
Rationing is unavoidable.

199
00:14:46,220 --> 00:14:48,590
This implies that potentially benefits.

200
00:14:49,160 --> 00:14:53,120
So as you can see, this is our application and this is the program that we need.

201
00:14:53,130 --> 00:14:54,440
As you can see, it is very easy.

202
00:14:54,770 --> 00:15:01,240
We have to do all the steps to step by step, even if you have never done or you have never used Python.

203
00:15:01,460 --> 00:15:07,850
So as you can see, you have just simple lines to open the PDA and simple lines to make it on you.

204
00:15:08,220 --> 00:15:12,230
And here we have this lines to create application step by step.

205
00:15:12,740 --> 00:15:15,640
After that, we have just to put the core of this.

206
00:15:15,810 --> 00:15:16,110
This.

207
00:15:16,800 --> 00:15:24,570
Function talk, which is which will do all the work, so if you want to make more changes, maybe you

208
00:15:24,570 --> 00:15:29,220
want to change the voice, or maybe you want to change the speed or something like that, it's up to

209
00:15:29,220 --> 00:15:31,690
you and you can do anything you want for the moment.

210
00:15:31,700 --> 00:15:40,080
This is the basic project and I hope to see your trying if I want you to try this application and I

211
00:15:40,080 --> 00:15:41,720
want to see it in my class project.

212
00:15:41,730 --> 00:15:48,600
So I want you to try any I don't want to I don't want you to do the same thing, for example, for the

213
00:15:48,600 --> 00:15:50,490
colors or something like that, like this.

214
00:15:50,490 --> 00:15:53,870
But I want to see if you are able to do this.

215
00:15:53,880 --> 00:15:55,410
I know that you are able to do this.

216
00:15:55,410 --> 00:16:01,560
So I just want you to share with me what you will find and what you will get at the end of this course.

217
00:16:01,980 --> 00:16:06,680
They hope to see all your projects in the projects path.

218
00:16:07,110 --> 00:16:09,900
And I see you in the next class by.
