1
00:00:01,770 --> 00:00:06,270
All right, so it's time to jump in and start writing code, so I've opened up the sublime text editor

2
00:00:06,270 --> 00:00:10,650
again, just go to your Windows Start menu type and sublime and an icon should pop up, click on it,

3
00:00:10,830 --> 00:00:12,090
and this should pop up.

4
00:00:12,420 --> 00:00:17,430
If there's no, like, untitled tab, you could just go to file new file.

5
00:00:17,880 --> 00:00:19,800
But I think this should pop up by default.

6
00:00:20,100 --> 00:00:22,080
So first thing we want to do is save this file.

7
00:00:22,080 --> 00:00:28,800
So it's going to file save as and you just want to navigate to your C drive.

8
00:00:29,040 --> 00:00:36,270
I'm going to click on this PC and my C drive and come down here to that top three directory that we

9
00:00:36,270 --> 00:00:38,250
just created in the last video.

10
00:00:38,760 --> 00:00:39,510
Double click it.

11
00:00:40,020 --> 00:00:44,130
And inside of here, we can save this file as anything we want.

12
00:00:44,160 --> 00:00:51,990
So let's call this player, DCPI and Python programs all end in DCPI That's what makes them Python program.

13
00:00:52,000 --> 00:00:57,660
So we in this and DCPI and hit enter and you can see up here now says player DCPI.

14
00:00:57,660 --> 00:00:59,720
So, all right, we've got our file.

15
00:00:59,730 --> 00:01:00,250
This is working.

16
00:01:00,540 --> 00:01:03,720
This is where we're going to be doing all the work throughout the rest of the course right here on this

17
00:01:03,720 --> 00:01:04,090
file.

18
00:01:04,380 --> 00:01:07,710
So the first thing we want to do is to create a basic hinter app.

19
00:01:07,980 --> 00:01:09,300
Now, I call it Kintyre.

20
00:01:09,300 --> 00:01:10,680
Some people call it tech center.

21
00:01:10,680 --> 00:01:12,630
It's spelled tenter, but I say Kintyre.

22
00:01:12,630 --> 00:01:15,990
So often I think the T should be silent, so I just make it silent.

23
00:01:16,000 --> 00:01:18,930
I don't know if it's the way it is, but I'm going to call it can.

24
00:01:18,940 --> 00:01:24,810
D'Urso Kintyre comes with Python, but in order to use it, we have to import it into this file that

25
00:01:24,810 --> 00:01:25,650
we've just created.

26
00:01:25,650 --> 00:01:34,860
So to do that, we go from Tenter, from Kintner import and then the star and I get the star from hitting

27
00:01:34,860 --> 00:01:41,270
the shift key and the eight number eight on my keyboard so that imports Kintner and now we can use it.

28
00:01:41,520 --> 00:01:48,240
So the first thing to do when you create a counter app is you have to set a Akintola instance and we're

29
00:01:48,240 --> 00:01:49,110
going to call this root.

30
00:01:49,110 --> 00:01:52,530
That's a convention that most new programs use.

31
00:01:52,530 --> 00:01:55,590
The main window of our app is going to be the root window.

32
00:01:55,740 --> 00:02:01,700
So we could set that to Teekay and then parentheses notice the T is capitalized and the K is lowercase.

33
00:02:01,710 --> 00:02:02,490
This is important.

34
00:02:03,000 --> 00:02:07,500
Don't do lowercase, don't do both uppercase.

35
00:02:07,800 --> 00:02:10,280
One is uppercase and lowercase and that's important.

36
00:02:10,320 --> 00:02:14,160
So this will create an instance of Quinter now.

37
00:02:15,150 --> 00:02:20,970
In order to run this file, we have to have something called a main loop, and this always goes at the

38
00:02:20,970 --> 00:02:21,870
bottom of our app.

39
00:02:21,880 --> 00:02:26,090
So I'm going to give it some spaces and I'm going to type root dot, main loop.

40
00:02:26,760 --> 00:02:29,550
And what this does is it creates a loop that's always looping.

41
00:02:29,770 --> 00:02:33,270
And as that thing is looping, it's watching sort of.

42
00:02:33,420 --> 00:02:33,800
Right.

43
00:02:33,810 --> 00:02:38,310
And as you move your mouse, the loop notices, oh, the mouse has moved a bit.

44
00:02:38,580 --> 00:02:39,600
Oh, it loops again.

45
00:02:39,600 --> 00:02:40,470
Oh, it's moved a bit.

46
00:02:40,470 --> 00:02:40,890
A bit.

47
00:02:40,890 --> 00:02:41,220
A bit.

48
00:02:41,380 --> 00:02:46,290
You click on a button, that loop is looping and it sees, oh, you click the button, it's the loop

49
00:02:46,290 --> 00:02:49,200
that's always running that allows the whole program to work.

50
00:02:49,200 --> 00:02:51,150
So you have to always have this main loop.

51
00:02:51,150 --> 00:02:52,320
It always goes at the bottom.

52
00:02:52,560 --> 00:02:53,640
And that's how we do that.

53
00:02:54,090 --> 00:02:56,430
So let's give our appetite.

54
00:02:56,430 --> 00:03:02,610
Also, we can go route title and then let's just say MP three player.

55
00:03:06,090 --> 00:03:12,390
OK, and we'll see what this isn't just the second let's go route dot geometry.

56
00:03:14,530 --> 00:03:17,630
And let's put this to five hundred by four hundred.

57
00:03:17,650 --> 00:03:23,080
This tells us the size of our app, it's going to be five hundred pixels by four hundred pixels, and

58
00:03:23,230 --> 00:03:24,210
that's how big it will be.

59
00:03:24,490 --> 00:03:27,270
And I think that's all for now.

60
00:03:27,280 --> 00:03:28,120
Let's go ahead and say this.

61
00:03:28,120 --> 00:03:30,790
I'm going to hit the control button and s button at the same time.

62
00:03:30,790 --> 00:03:31,900
I might give you a keyboard.

63
00:03:32,110 --> 00:03:37,030
I think it's command s if you're on a Mac or you can go up here to file and click save you see right

64
00:03:37,030 --> 00:03:37,170
there.

65
00:03:37,190 --> 00:03:43,270
So control s so to run this, we head back over to our terminal, make sure you're in your MP three

66
00:03:43,270 --> 00:03:50,040
directory, make sure your virtual environment is turned on and we just type in Python player DCPI.

67
00:03:50,050 --> 00:03:56,140
Now if you're on a Mac or Linux and this doesn't work, try Python three player, not pi, but it should

68
00:03:56,140 --> 00:03:56,470
work.

69
00:03:57,880 --> 00:03:58,810
And when we do.

70
00:03:59,920 --> 00:04:05,350
This box pops up, so you see it's got this little icon, that's the default counter icon, we can change

71
00:04:05,350 --> 00:04:13,810
that if we want and it says MP three player, that's what see this title did it typed in MP three player.

72
00:04:14,170 --> 00:04:19,120
And we've got a box that's five hundred by four hundred pixels in size and.

73
00:04:19,120 --> 00:04:20,320
All right, looking good.

74
00:04:20,320 --> 00:04:21,550
So congratulations.

75
00:04:21,550 --> 00:04:28,450
You've created your very first program with your very basic not much to it, but that's just how easy

76
00:04:28,450 --> 00:04:33,670
it is to start to create graphical user interfaces with Kanter, which is one of the reasons why we

77
00:04:33,670 --> 00:04:34,270
love Kintner.

78
00:04:34,270 --> 00:04:35,200
It's just so easy.

79
00:04:35,440 --> 00:04:40,840
Back in the old days, just even doing something as simple as this would take like 50 or 60 lines of

80
00:04:40,840 --> 00:04:41,440
code.

81
00:04:41,740 --> 00:04:48,040
And here we have one, two, three, four or five lines of code and we've got a little app now.

82
00:04:48,040 --> 00:04:51,550
It doesn't do anything, but hey, at least it's been created and it looks good.

83
00:04:51,550 --> 00:04:52,690
So that's all for this video.

84
00:04:52,690 --> 00:04:54,910
In the next video, we'll start to build this thing out.
