1
00:00:01,680 --> 00:00:07,320
OK, we are coming right along in this video, I want to add the menu up at the top here where we could

2
00:00:07,320 --> 00:00:11,550
add songs and delete songs so we can start out with a menu for adding songs.

3
00:00:11,820 --> 00:00:17,100
We'll do delete songs later after we've set up the ability to actually add the songs.

4
00:00:17,280 --> 00:00:19,410
So, OK, we need to add a menu up here.

5
00:00:19,410 --> 00:00:21,030
And with counter, this is fairly easy.

6
00:00:21,300 --> 00:00:23,060
So let's come down here.

7
00:00:23,460 --> 00:00:27,150
Does it really matter where straight here and let's create a comment.

8
00:00:27,150 --> 00:00:28,980
Let's say create a menu.

9
00:00:29,220 --> 00:00:31,970
And so we're going to name this my menu.

10
00:00:32,670 --> 00:00:36,380
And this is a menu widget and we want to put it in our window.

11
00:00:36,510 --> 00:00:38,160
That's really all there is to creating a menu.

12
00:00:38,190 --> 00:00:40,620
Now we're going to have to do more stuff to put stuff onto the menu.

13
00:00:40,890 --> 00:00:42,930
But first, we need to put this up on the screen.

14
00:00:42,930 --> 00:00:45,630
So let's go route config.

15
00:00:46,170 --> 00:00:52,920
Remember, this is our route window and we want to configure it to add a menu equal to my underscore

16
00:00:52,920 --> 00:00:55,780
menu, which is just what we named our menu.

17
00:00:55,950 --> 00:00:57,610
So this will create the menu.

18
00:00:58,080 --> 00:01:05,190
Now, let's say create add song menu dropdown.

19
00:01:06,930 --> 00:01:13,210
Right, so let's go and underscore song, underscore menu, and this is going to be in the menu widget,

20
00:01:13,210 --> 00:01:15,020
and which menu do we want to use?

21
00:01:15,040 --> 00:01:16,300
Well, we only have one menu.

22
00:01:16,310 --> 00:01:18,400
That's my underscore menu we just created.

23
00:01:18,820 --> 00:01:24,790
So then we can go my underscore menu dot add underscore Kaskade.

24
00:01:25,450 --> 00:01:28,600
And this allows us to add things to our menu.

25
00:01:28,600 --> 00:01:31,290
So we want to and they sort of cascade down.

26
00:01:31,300 --> 00:01:32,920
So there's one on top of another.

27
00:01:33,130 --> 00:01:33,440
Right.

28
00:01:33,820 --> 00:01:36,760
So this will become apparent after we build a couple of these out.

29
00:01:36,790 --> 00:01:43,720
So let's go, let's create a label and let's say add songs need to be in quotation marks, so add songs

30
00:01:44,320 --> 00:01:47,700
and then let's say we want to put this in the menu.

31
00:01:47,710 --> 00:01:48,350
What menu?

32
00:01:48,370 --> 00:01:53,220
Well, we just created this second menu, sort of like a sub menu and we want to put it there.

33
00:01:53,500 --> 00:01:57,730
So I'll just copy and paste that and that's good there.

34
00:01:58,510 --> 00:02:03,970
Now, if we want to give this a command, which we probably don't yet, we can do that.

35
00:02:03,970 --> 00:02:06,490
But let's just save this and run it just to see if that worked.

36
00:02:08,760 --> 00:02:13,590
So we see up here says songs, if we click on it, nothing actually pops up because we haven't given

37
00:02:13,590 --> 00:02:14,520
it a command yet.

38
00:02:14,850 --> 00:02:21,420
But coming right along and maybe instead of songs, I say add songs, save this.

39
00:02:22,480 --> 00:02:26,470
Run this again now, says ad songs, when we click on it, nothing happens.

40
00:02:26,500 --> 00:02:32,080
So, OK, so if we want to add something to that menu, when we click on it, when it drops down to

41
00:02:32,080 --> 00:02:33,670
have stuff, let's do that.

42
00:02:33,700 --> 00:02:39,780
So let's go and underscore song, underscore menu, dot ad, underscore command.

43
00:02:40,840 --> 00:02:44,340
So each item in our menu is a command, right.

44
00:02:44,350 --> 00:02:46,840
Because when we click on it, we want something to happen.

45
00:02:46,990 --> 00:02:51,450
And when we make things happen by clicking on them encounter, that's usually a command.

46
00:02:51,580 --> 00:02:54,900
So when you click a button that you know, you're you're giving it a command.

47
00:02:55,090 --> 00:02:58,060
So we add command and let's give us a label.

48
00:02:59,120 --> 00:03:05,990
Equal to and notice, these look like capital ls these are lowercase l sublime changes the shape of

49
00:03:05,990 --> 00:03:06,140
them.

50
00:03:06,140 --> 00:03:10,100
For some reason this is a capital L. You can see it's angular.

51
00:03:10,580 --> 00:03:12,260
This is a lower case.

52
00:03:12,260 --> 00:03:13,850
L. It's kind of squiggly.

53
00:03:14,240 --> 00:03:16,670
I don't know why sublime does that.

54
00:03:16,670 --> 00:03:17,570
It drives me crazy.

55
00:03:17,570 --> 00:03:24,800
It looks like a capital l but that is a lowercase L so let's go add one song to play list.

56
00:03:25,970 --> 00:03:35,270
All right, and now we want to give this a command equals to add underscore song, so we need to actually

57
00:03:35,270 --> 00:03:39,260
create a function that will run whenever we click this command.

58
00:03:39,470 --> 00:03:41,090
So we can do that, we can come up here.

59
00:03:44,600 --> 00:03:47,300
I'm just going to go the very top of our map here.

60
00:03:47,540 --> 00:03:53,050
Let's define a function and for now I'm just going to type pass, meaning don't do anything right.

61
00:03:53,070 --> 00:03:55,640
So this is how we create functions with Python, if you're not familiar.

62
00:03:56,060 --> 00:03:57,260
That's the common format.

63
00:03:57,300 --> 00:03:57,910
So, all right.

64
00:03:57,920 --> 00:04:00,740
Let's go ahead and save this and run it to see if that worked.

65
00:04:03,630 --> 00:04:07,550
So we see ad songs when we click on it, it says ad one song to playlist.

66
00:04:07,920 --> 00:04:08,640
Very cool.

67
00:04:08,850 --> 00:04:10,470
So let's add a second one.

68
00:04:10,680 --> 00:04:18,360
So we've we've created a menu item that says add one song, let's just copy this thing pasted in again.

69
00:04:18,930 --> 00:04:23,730
And underneath I'm going to comment, add many songs.

70
00:04:23,970 --> 00:04:25,800
And above this one, I'm going to comment.

71
00:04:25,830 --> 00:04:33,060
Add one song to playlist and many songs to playlist.

72
00:04:34,220 --> 00:04:41,030
OK, and so instead of it saying add one song, let's say add many songs, and here at the command,

73
00:04:41,210 --> 00:04:48,080
let's give it a command of add, underscore many underscore songs, and we need to now create this command.

74
00:04:48,080 --> 00:04:52,550
So it's come back up to the top of our app and let's define another function.

75
00:04:54,820 --> 00:05:05,470
And also this pass and also let's comment this or create function to add many songs to a playlist and

76
00:05:05,470 --> 00:05:13,300
above this one list to find this, to say create function, to add one song to playlist.

77
00:05:13,510 --> 00:05:15,040
Always a good idea to comment your codes.

78
00:05:15,040 --> 00:05:20,740
I'm really bad at it, but this is going to be a kind of a long program, lots of lines of code.

79
00:05:20,740 --> 00:05:23,240
So it's important that we comment all of these, so.

80
00:05:23,350 --> 00:05:25,380
All right, let's go ahead and save this and run it one more time.

81
00:05:28,350 --> 00:05:33,100
And we see add this, and when we click these things, nothing happens yet because we just click pass.

82
00:05:33,120 --> 00:05:34,800
Now notice this dotted line.

83
00:05:34,800 --> 00:05:36,390
This is something called a tear off.

84
00:05:36,600 --> 00:05:43,140
And this is where with Cantor, if you grab this and drag it and drop it, this allows you to kind of

85
00:05:43,950 --> 00:05:45,120
pull this thing off.

86
00:05:45,120 --> 00:05:47,580
And we can't do it yet because we haven't coated it, too.

87
00:05:47,580 --> 00:05:49,780
But some people like this dotted line there.

88
00:05:49,800 --> 00:05:50,490
Some people don't.

89
00:05:50,490 --> 00:05:56,310
You can get rid of it if you want, just by setting an attribute down here.

90
00:05:56,310 --> 00:06:03,240
So if we go to our menu and right here where we created our sort of submenu, we can go, comma, tear

91
00:06:03,240 --> 00:06:05,010
off equals zero.

92
00:06:05,370 --> 00:06:07,230
And if we save this and run it.

93
00:06:11,320 --> 00:06:17,800
Now that dotted thing is gone, so just however you prefer that no big deal, so, OK, that's all for

94
00:06:17,800 --> 00:06:18,250
this video.

95
00:06:18,250 --> 00:06:23,980
In the next video, we'll start to actually write the code to add the songs when we click on these things.

96
00:06:24,130 --> 00:06:25,780
And that'll be coming up in the next video.
