1
00:00:01,700 --> 00:00:06,950
OK, in this video, I want to talk about creating labels and labels, I mean, text anytime you want

2
00:00:06,950 --> 00:00:11,570
to put any sort of text on your program, on your graphical user interface, you're going to use something

3
00:00:11,570 --> 00:00:12,710
called a label widget.

4
00:00:12,980 --> 00:00:17,720
Now, I should mention Kintyre is made up almost completely of widgets.

5
00:00:17,720 --> 00:00:19,520
Everything in Kintore is a widget.

6
00:00:19,730 --> 00:00:22,310
So if you want to add a button, you add a button widget.

7
00:00:22,310 --> 00:00:24,650
If you want to add a label, you add a label widget.

8
00:00:24,650 --> 00:00:26,120
So it's all widgets.

9
00:00:26,250 --> 00:00:28,490
That's just sort of the terminology Carpenter uses.

10
00:00:28,520 --> 00:00:32,270
So if I refer to things as widgets, that's what I'm talking about.

11
00:00:32,270 --> 00:00:35,390
A lot of times I won't even mention widget because everything's a widget.

12
00:00:35,660 --> 00:00:37,280
So you just assume it's a widget.

13
00:00:37,280 --> 00:00:39,320
So just something to keep in mind.

14
00:00:39,350 --> 00:00:42,740
So, all right, let's create a label.

15
00:00:42,740 --> 00:00:46,580
We want to put it on our screen, know we've got this title, but that's not really a label.

16
00:00:46,580 --> 00:00:47,480
That's just the title.

17
00:00:47,690 --> 00:00:52,220
So to create anything, intenta, it's always a two step process.

18
00:00:52,220 --> 00:00:56,750
You create the thing and then you put the thing on the screen, you create it, put it on the screen,

19
00:00:56,750 --> 00:00:58,550
create, create it, put it on the screen.

20
00:00:58,700 --> 00:01:00,980
And there's a couple of different ways to put things on the screen.

21
00:01:00,980 --> 00:01:02,780
And we'll talk about those in the coming videos.

22
00:01:03,410 --> 00:01:04,790
But that's always the process.

23
00:01:04,790 --> 00:01:06,110
Create it, put it on the screen.

24
00:01:06,110 --> 00:01:07,430
So let's create it first.

25
00:01:07,430 --> 00:01:09,080
Let's create a variable.

26
00:01:09,320 --> 00:01:14,300
I'm just going to call it my label and we'll talk about naming conventions and things like that going

27
00:01:14,300 --> 00:01:14,660
forward.

28
00:01:14,660 --> 00:01:19,250
But I'm just going to name this my label because it's the label and you can name it anything you want.

29
00:01:19,520 --> 00:01:21,650
And like I said, this is a label widget.

30
00:01:21,950 --> 00:01:27,680
So we use the label function and now we have to tell our program, where do we want this label to go?

31
00:01:27,990 --> 00:01:29,450
Well, we only have one thing.

32
00:01:29,450 --> 00:01:31,250
We have a root window.

33
00:01:31,730 --> 00:01:34,460
That first window we created, that's our root window.

34
00:01:34,460 --> 00:01:34,940
Why?

35
00:01:35,240 --> 00:01:42,440
Because we created a root instance of teak and our main loop is running on our root window.

36
00:01:42,530 --> 00:01:42,720
Right.

37
00:01:42,820 --> 00:01:45,740
So we want this label to go on the root window.

38
00:01:46,010 --> 00:01:50,660
So here we can go text equals and we can say anything we want.

39
00:01:50,660 --> 00:01:51,170
Let's just go.

40
00:01:51,170 --> 00:01:51,910
Hello world.

41
00:01:52,820 --> 00:01:53,900
Now that's step one.

42
00:01:54,330 --> 00:01:55,920
Like I said, it's always a two step process.

43
00:01:55,920 --> 00:01:57,650
So now we need to put this on the screen.

44
00:01:57,650 --> 00:02:02,780
So let's go my underscore label dot pack, and that's a function.

45
00:02:02,780 --> 00:02:07,400
Now, there's a couple of different ways you can put things on the screen, you can pack it or you can

46
00:02:07,400 --> 00:02:08,360
use the grid system.

47
00:02:08,360 --> 00:02:10,730
And we're going to talk about both of those systems in detail.

48
00:02:11,060 --> 00:02:13,250
But pack is the easier one.

49
00:02:13,250 --> 00:02:20,870
It just kind of I wouldn't say randomly, but it sort of defaults things up into a default sort of position.

50
00:02:21,390 --> 00:02:24,290
You can't really tell things where to go in packs so much.

51
00:02:24,440 --> 00:02:26,480
It's just going to pack it onto the screen for you.

52
00:02:26,930 --> 00:02:31,070
Now, we're going to use mostly the grid system going forward and in the grid system.

53
00:02:31,310 --> 00:02:37,880
Think of your app as a grid, rows and columns and so you can tell it exactly where to put things.

54
00:02:37,880 --> 00:02:42,590
So you could say put it in a row one column to, you know, and move things around specifically.

55
00:02:42,830 --> 00:02:43,940
That's not what Pack does.

56
00:02:43,940 --> 00:02:45,440
Pack just packs it on the screen.

57
00:02:45,440 --> 00:02:49,760
So for this simple very first program or second program, I guess we're just going to pack this on the

58
00:02:49,760 --> 00:02:50,090
screen.

59
00:02:50,090 --> 00:02:50,270
So.

60
00:02:50,470 --> 00:02:52,340
All right, go ahead and click.

61
00:02:52,790 --> 00:02:57,350
Control is the save this and head back over here and control.

62
00:02:57,370 --> 00:03:02,390
See, to break out of this or we can just click the little X on the program that we were running and

63
00:03:02,430 --> 00:03:05,600
I'm going to press up a few times to run our program again.

64
00:03:05,660 --> 00:03:06,320
Python Hello.

65
00:03:06,380 --> 00:03:06,860
Up high.

66
00:03:07,310 --> 00:03:14,120
And when we do, we see this hello world has popped up on the screen and you'll notice it's just right

67
00:03:14,120 --> 00:03:14,510
in the middle.

68
00:03:14,510 --> 00:03:17,180
It's the very first thing at the very top of the program.

69
00:03:17,180 --> 00:03:18,650
It's just packed it on there.

70
00:03:18,920 --> 00:03:22,070
If we were to put another thing, it would pack it right underneath it.

71
00:03:22,070 --> 00:03:23,210
So let's do that real quick.

72
00:03:24,170 --> 00:03:29,750
I'm just going to let's go ahead, close this and then we can just copy all of this.

73
00:03:30,170 --> 00:03:31,880
And my label, too.

74
00:03:32,570 --> 00:03:33,470
And here.

75
00:03:34,830 --> 00:03:40,740
Let's say a second thing, right, and again, we're just going to pack this on the screen so we save

76
00:03:40,740 --> 00:03:43,980
this and head back over to the terminal and we're on this again.

77
00:03:46,030 --> 00:03:48,520
You see, it just packed it right underneath there, right?

78
00:03:48,550 --> 00:03:50,710
So the second thing just goes right underneath there.

79
00:03:50,740 --> 00:03:57,670
So if you're doing very basic apps and you're not really you don't really care so much about how things

80
00:03:57,670 --> 00:04:00,280
are positioned, pack is a good thing to use.

81
00:04:00,770 --> 00:04:02,800
Otherwise, you're going to want to use the grid system.

82
00:04:02,800 --> 00:04:06,310
And I think in the next video we'll start to look at the grid system and I'll show you how to use it.

83
00:04:06,880 --> 00:04:10,740
But, yeah, that's that's how you that's how you create widgets.

84
00:04:10,990 --> 00:04:17,200
This is the first widget that that you always want to learn the label widget and most of the widgets

85
00:04:17,200 --> 00:04:20,620
that say almost all of the widgets have the same sort of.

86
00:04:21,910 --> 00:04:27,010
Look, right, you create a variable name and anything you want, you set it equal to whatever that

87
00:04:27,010 --> 00:04:31,450
widget is, you know, a label widget, a button widget, a frame widget, whatever widget.

88
00:04:31,630 --> 00:04:33,580
And we'll look at all the widgets going forward.

89
00:04:33,790 --> 00:04:39,580
And then you tell it where you want the thing to go, you know, put it in our root and then you configure

90
00:04:39,580 --> 00:04:42,430
the widget in whichever way it needs to be configured.

91
00:04:43,350 --> 00:04:48,240
Just like that, and then after that, you just put it on the screen somehow, so, you know, this

92
00:04:48,240 --> 00:04:52,830
is Kintner, this is it in a nutshell, it doesn't get a whole lot more complicated than what you're

93
00:04:52,830 --> 00:04:53,850
looking at right here.

94
00:04:54,030 --> 00:04:55,110
And this is pretty easy.

95
00:04:55,120 --> 00:04:56,920
So that's one of the great things about Kintner.

96
00:04:56,940 --> 00:05:00,300
That's why it's so popular, because it's pretty easy to do so.

97
00:05:00,570 --> 00:05:02,340
So that's basic labels.

98
00:05:02,340 --> 00:05:06,180
And the next video, we'll start to look at the label in a little bit more detail.

99
00:05:06,180 --> 00:05:09,660
There's some more options you can use and we'll look at those in the next video.
