1
00:00:01,580 --> 00:00:05,930
OK, in this video, we want to look at input boxes so we can type stuff into little boxes.

2
00:00:05,940 --> 00:00:08,030
Now, Cantor doesn't call them input boxes.

3
00:00:08,030 --> 00:00:09,890
Cantor calls them entry widgets.

4
00:00:10,160 --> 00:00:12,700
So you're entering text, right?

5
00:00:12,740 --> 00:00:14,000
I don't know, entry widget.

6
00:00:14,010 --> 00:00:16,530
So I've created a little comment here.

7
00:00:16,550 --> 00:00:19,810
This is entry widget, and we can name this anything we want.

8
00:00:19,820 --> 00:00:21,320
I'm just going to call it E for entry.

9
00:00:21,500 --> 00:00:26,180
And it's an entry widget and we want to put it in route and that's it.

10
00:00:26,270 --> 00:00:27,410
That's all we really have to do.

11
00:00:27,420 --> 00:00:32,570
So let's go pack to pack this on the screen and let's just kind of save this and take a look at what

12
00:00:32,570 --> 00:00:32,990
we got.

13
00:00:34,420 --> 00:00:35,530
So let's run this.

14
00:00:36,830 --> 00:00:41,570
And here we have a little box and we can type stuff in and nothing happens when we do, but we've got

15
00:00:41,570 --> 00:00:42,230
a box now.

16
00:00:42,230 --> 00:00:44,570
We can resize this in a couple of different ways.

17
00:00:44,570 --> 00:00:48,230
First, we can change the width just by calling width equals.

18
00:00:48,230 --> 00:00:50,660
And let's set this equal to, I don't know, three hundred.

19
00:00:51,090 --> 00:00:55,880
So if we save this runit, see, now it's stretch bigger.

20
00:00:57,020 --> 00:00:58,610
Right, and also.

21
00:00:59,630 --> 00:01:09,230
Let's let's give this a pair why of 20 to kind of move it apart here, we can also create change the

22
00:01:09,230 --> 00:01:13,760
height of it by changing the font so we can go font.

23
00:01:15,180 --> 00:01:17,250
Equals just like we do with a label.

24
00:01:17,580 --> 00:01:25,490
Let's go Helvetica, Helvetica, and then we say we want a size thirty two if we save this and run it.

25
00:01:26,170 --> 00:01:31,050
So you'll notice now the boxes taller because the text is bigger.

26
00:01:31,380 --> 00:01:32,390
So that's how you do that.

27
00:01:33,250 --> 00:01:44,950
So we can sort of get the thing that was typed into the box by calling e dot get right e douget and

28
00:01:44,950 --> 00:01:46,780
we could send this to a variable if we want.

29
00:01:46,780 --> 00:01:52,930
We could say input equals Edgard if we want or we could just call e get.

30
00:01:53,200 --> 00:01:57,000
So for instance, if we created let's come up here.

31
00:01:57,910 --> 00:01:59,140
So we call this clicked.

32
00:01:59,740 --> 00:02:04,510
Let's change this from the lambda thing to clicked.

33
00:02:05,020 --> 00:02:05,270
Right.

34
00:02:05,310 --> 00:02:06,760
So now when we click the button.

35
00:02:07,650 --> 00:02:14,940
It's going to call this click function and let's come up here to our label and let's say enter your

36
00:02:14,940 --> 00:02:15,720
name.

37
00:02:17,420 --> 00:02:19,460
Right, and then let's get rid of all this.

38
00:02:24,410 --> 00:02:33,170
All right, so now our label just says, enter your name below it is the box and let's get rid of Wow.

39
00:02:33,470 --> 00:02:36,050
Change this to smaller, say, 18.

40
00:02:36,530 --> 00:02:36,940
I don't know.

41
00:02:36,950 --> 00:02:37,910
Let's change this.

42
00:02:40,190 --> 00:02:45,490
Let's just do it like this, so now when you click the button, we call this click function.

43
00:02:45,800 --> 00:02:54,590
So now instead of you click the button, let's just type in or let's just print out e dot get.

44
00:02:55,730 --> 00:02:57,840
And it's a function we just do like that.

45
00:02:58,220 --> 00:03:00,110
All right, so let's save this now.

46
00:03:00,120 --> 00:03:06,620
This may or may not work with pack, so I'm just going to take this and bring it down here and go like

47
00:03:06,620 --> 00:03:07,010
that.

48
00:03:08,070 --> 00:03:10,950
OK, so let's say this and see what we got.

49
00:03:12,010 --> 00:03:13,540
Horses, enter your name.

50
00:03:13,870 --> 00:03:15,190
My name is John.

51
00:03:16,620 --> 00:03:22,530
Boot prints out John, pretty cool now we can play around with this, we can instead of.

52
00:03:23,550 --> 00:03:25,260
This we can go.

53
00:03:26,750 --> 00:03:34,190
Hello, and then concatenate like Python allows us to with the add sign and then put it together so

54
00:03:34,820 --> 00:03:36,460
we can come back here and run this again.

55
00:03:38,210 --> 00:03:39,170
Enter your name.

56
00:03:40,190 --> 00:03:42,170
John hurt me.

57
00:03:42,290 --> 00:03:43,040
Hello, John.

58
00:03:43,340 --> 00:03:45,330
So now we're starting to get some functionality, right?

59
00:03:45,350 --> 00:03:47,600
This is fun and just that easy.

60
00:03:47,600 --> 00:03:51,140
So, you know, entry boxes are so fundamental.

61
00:03:51,620 --> 00:03:54,830
I don't care what program you're going to create, you're almost certainly going to want to get some

62
00:03:54,830 --> 00:03:58,360
user input somehow by having people type things into boxes.

63
00:03:58,940 --> 00:04:00,890
And this is how you do it, using the entry widget.

64
00:04:01,160 --> 00:04:07,340
And then, like I said, you can call it by calling E get any time you want, whatever somebody put

65
00:04:07,340 --> 00:04:09,970
into those boxes, you just do it like that.

66
00:04:09,980 --> 00:04:12,920
Now, again, we used E Arget.

67
00:04:12,920 --> 00:04:15,530
I mentioned we could put this in a variable if we wanted to.

68
00:04:15,830 --> 00:04:17,120
We call input.

69
00:04:18,230 --> 00:04:24,500
Or whatever equals e doget, and then inside of here, we could reference input.

70
00:04:26,000 --> 00:04:30,500
If you would rather do it like that, so then you have this variable that you can reference from time

71
00:04:30,500 --> 00:04:35,390
to time that works too, if we run this, absolutely nothing will have changed.

72
00:04:36,110 --> 00:04:38,870
We just type in John again and click the button.

73
00:04:39,770 --> 00:04:40,550
Hello, John.

74
00:04:41,810 --> 00:04:42,590
If we change it.

75
00:04:45,230 --> 00:04:50,810
But it changes so very cool, so in the next video, I think we'll look at this little icon guy up here

76
00:04:51,050 --> 00:04:52,800
and learn how to change that.
