1
00:00:01,700 --> 00:00:07,010
OK, so in this video, we want to be able to add actual songs when we click this thing, we want a

2
00:00:07,010 --> 00:00:11,740
little file dialogue box to pop up and where we can select songs to add to our playlist.

3
00:00:11,750 --> 00:00:13,810
So that's we're going to start working on in this video.

4
00:00:13,820 --> 00:00:17,590
It might take probably a couple of videos for us to do this, but it's pretty easy.

5
00:00:17,600 --> 00:00:21,530
So let's go out and close this and head back over to our code.

6
00:00:22,850 --> 00:00:29,000
Now, a final dialog box, when I click, say, file, open this thing that pops up, this is a file

7
00:00:29,000 --> 00:00:30,280
dialog box, right?

8
00:00:30,290 --> 00:00:33,730
So we don't want to write the code to make something like this.

9
00:00:33,980 --> 00:00:40,820
Luckily, Kintore has a module that you can add that will do it all for us so we don't have to recreate

10
00:00:40,820 --> 00:00:41,440
the wheel here.

11
00:00:41,450 --> 00:00:47,210
So when I mentioned earlier that Kintner Everything Encounter is a widget, there are some special widgets

12
00:00:47,210 --> 00:00:52,970
that come with Kintner, but they're more complicated and they're not set up by default.

13
00:00:52,970 --> 00:00:57,590
And you can add them just by importing importing them from the top of your code here and then you could

14
00:00:57,590 --> 00:00:57,980
use them.

15
00:00:57,990 --> 00:00:59,870
They're they're called TDK widgets.

16
00:01:00,170 --> 00:01:04,040
So we're going to use probably a couple of them in this course.

17
00:01:04,490 --> 00:01:06,950
But the one we want to do now is the file dialog box.

18
00:01:06,950 --> 00:01:14,840
So to do that, we can't we compare and we go from tenter import and it's file dialogue.

19
00:01:15,230 --> 00:01:17,900
Now, up here we imported everything.

20
00:01:17,900 --> 00:01:19,790
So you would think it would come with this.

21
00:01:19,790 --> 00:01:22,930
But for whatever reason, with Kentner, you have to do this separately.

22
00:01:22,940 --> 00:01:28,100
So now we can use the file dialog box stuff to do whatever we want.

23
00:01:28,130 --> 00:01:32,870
So now let's go to our ad song and this is adding one song.

24
00:01:33,050 --> 00:01:38,600
So instead of pass here, let's create a variable and let's call it song because we want to get a song.

25
00:01:38,600 --> 00:01:39,710
So let's just call it song.

26
00:01:40,010 --> 00:01:46,100
And to use this, we call file dialogue and file dialogue has a bunch of different things you can use.

27
00:01:46,100 --> 00:01:53,150
The thing we want to do is open a file, so we want to call, ask open file name and it's a function.

28
00:01:53,480 --> 00:01:57,250
And if we save this and just run it, let's just see if that did anything at all.

29
00:01:58,300 --> 00:02:03,820
Let's pull this over, we can add songs, we click this boom, a box pops up and just like that, it

30
00:02:03,820 --> 00:02:04,190
works.

31
00:02:04,210 --> 00:02:10,000
Now this is defaulting to the last thing I open, which has nothing to do with this course.

32
00:02:10,150 --> 00:02:16,060
But you can now navigate around and find different, you know, click on different folders, find whatever

33
00:02:16,060 --> 00:02:17,710
music you want and then click on them.

34
00:02:18,010 --> 00:02:26,980
And then what happens is it will return the file name and it will assign it to its proper code, this

35
00:02:26,980 --> 00:02:27,600
variable.

36
00:02:27,940 --> 00:02:37,150
So for the purposes of this course, I want to create a folder in our top three directory where we're

37
00:02:37,150 --> 00:02:40,350
working here that will hold all of our song files.

38
00:02:40,360 --> 00:02:42,990
You don't really have to do this, but it kind of makes sense to me.

39
00:02:43,150 --> 00:02:48,520
And then I want to set this thing to default to that directory when you click that button.

40
00:02:48,520 --> 00:02:52,690
So your your music will be right there and you can pick on which song you want to open.

41
00:02:52,720 --> 00:02:55,900
So head back over to a terminal and we're in our C slash and through directory.

42
00:02:55,910 --> 00:02:59,800
Make sure your virtual environment is turned on, though it doesn't really have to be for this, but

43
00:02:59,800 --> 00:03:04,300
it's a good idea that you haven't turned on anytime you're working on your code and let's make a directory.

44
00:03:04,300 --> 00:03:07,630
And to do that we go Diar and I'm going to call this audio.

45
00:03:08,440 --> 00:03:13,880
So now when else we could see we have this audio folder already set up.

46
00:03:14,020 --> 00:03:20,980
So now if you go to your Windows Start menu and just type in file explorer, two words, this will pop

47
00:03:20,980 --> 00:03:21,240
up.

48
00:03:21,250 --> 00:03:23,170
Now you can navigate to your C drive.

49
00:03:23,320 --> 00:03:25,450
We could find our number three directory.

50
00:03:25,600 --> 00:03:28,010
And then there's that audio folder we just created.

51
00:03:28,010 --> 00:03:29,590
If we click on it, there's nothing there.

52
00:03:29,590 --> 00:03:33,850
So I want to add a bunch of image or a bunch of songs to this folder.

53
00:03:34,090 --> 00:03:36,460
This you know, I have some songs on my computer.

54
00:03:36,460 --> 00:03:38,890
I'm just going to copy them into this directory.

55
00:03:39,310 --> 00:03:41,020
So I've copy them off screen.

56
00:03:41,020 --> 00:03:42,520
I'm just going to paste the men here.

57
00:03:43,000 --> 00:03:44,380
This isn't really part of the course.

58
00:03:44,380 --> 00:03:46,510
I'm just adding some music to this folder.

59
00:03:46,510 --> 00:03:48,280
You can put any songs in here you want, really.

60
00:03:48,280 --> 00:03:52,930
Doesn't matter if you can leave it empty if you wanted to, but we're going to be needing some songs

61
00:03:52,930 --> 00:03:53,370
to play with.

62
00:03:53,370 --> 00:03:54,850
So I just put in some random songs.

63
00:03:54,850 --> 00:03:56,500
I downloaded these off of YouTube.

64
00:03:56,920 --> 00:04:01,590
YouTube has a free music website where you can download free songs that you can use.

65
00:04:01,640 --> 00:04:04,570
I just downloaded some random songs and we're going to use those.

66
00:04:04,570 --> 00:04:07,990
So they're Narcy and B3 audio directory.

67
00:04:07,990 --> 00:04:13,420
So now when we click this button, for instance, when we come back here.

68
00:04:13,420 --> 00:04:17,440
And so let's go a python player, Torpy.

69
00:04:19,740 --> 00:04:25,680
When we click this ad, one song, this thing pops up, we want that audio directory to be the directory

70
00:04:25,680 --> 00:04:27,590
that pops up when we click that thing.

71
00:04:27,600 --> 00:04:30,930
So I think that's what will start to work on in the next video.
