1
00:00:01,680 --> 00:00:06,240
OK, in this video, I want to show you how to overwrite things and get rid of things, how to remove

2
00:00:06,240 --> 00:00:08,310
things, specifically, we're going to be looking at labels.

3
00:00:08,460 --> 00:00:11,520
So I've created a file called Forget That Pie.

4
00:00:11,850 --> 00:00:14,580
And it's very simple, actually.

5
00:00:14,580 --> 00:00:17,490
Let's just run this thing to see.

6
00:00:19,730 --> 00:00:25,670
And it's just a very basic thing here, have enter your name, we can enter our name, John Elder,

7
00:00:25,680 --> 00:00:26,870
we click the submit button.

8
00:00:26,900 --> 00:00:27,710
Hello, John Elder.

9
00:00:27,740 --> 00:00:28,660
So that's all this does.

10
00:00:28,820 --> 00:00:30,850
It's printing this label onto the screen.

11
00:00:30,860 --> 00:00:32,090
So let's look at this real quick.

12
00:00:33,440 --> 00:00:36,500
Just to walk through this code, we have.

13
00:00:37,290 --> 00:00:42,210
A label that says enter your name and I'm using the grid system here, that's why it's kind of mushed

14
00:00:42,210 --> 00:00:43,380
up in the corner like this.

15
00:00:43,650 --> 00:00:45,500
And we'll look at back in just a minute as well.

16
00:00:45,720 --> 00:00:47,160
So we have an entry box.

17
00:00:47,160 --> 00:00:48,450
We've learned how to do those.

18
00:00:48,450 --> 00:00:53,000
And that's just this box right here and a submit button and submit.

19
00:00:53,010 --> 00:00:59,100
And when we click it, it runs the submit function, which creates a new label and it says hello and

20
00:00:59,100 --> 00:01:03,540
then puts whatever you put in the box in and then grids it out onto the screen.

21
00:01:03,540 --> 00:01:04,890
So hello, John Elder.

22
00:01:05,730 --> 00:01:06,390
Pretty simple.

23
00:01:06,630 --> 00:01:13,020
Well, now, if we continue to do something here, if we went, John, for instance, and we wanted

24
00:01:13,020 --> 00:01:17,790
to click it again, it would kind of just put it on top of the other one that we already printed.

25
00:01:17,790 --> 00:01:19,140
And now it says, hello, John.

26
00:01:19,140 --> 00:01:21,160
And then the stuff you could see below it.

27
00:01:21,360 --> 00:01:22,350
This is just no good.

28
00:01:22,360 --> 00:01:25,080
So how do we kind of clear things?

29
00:01:25,350 --> 00:01:27,990
How do we overwrite things if we want?

30
00:01:28,380 --> 00:01:30,030
That's what we're going to be looking at in this video.

31
00:01:30,060 --> 00:01:31,560
Maybe, maybe the next video as well.

32
00:01:31,570 --> 00:01:32,970
See how long it takes us to get through this.

33
00:01:32,970 --> 00:01:38,210
So let's close this and let's create another button down here.

34
00:01:38,550 --> 00:01:41,490
And first, let's call it clear button.

35
00:01:42,420 --> 00:01:48,750
And this is going to be a button and it's going to go and route and the text will be clear and then

36
00:01:48,750 --> 00:01:51,600
the command will equal clear.

37
00:01:52,140 --> 00:01:57,840
Now, let's just grid this onto the screen.

38
00:01:57,900 --> 00:02:00,480
So row two, column one.

39
00:02:00,950 --> 00:02:03,440
So now we need to create this clear function real quick.

40
00:02:03,780 --> 00:02:09,440
So let's create clear function and so define clear.

41
00:02:09,870 --> 00:02:11,060
And what do we want to do?

42
00:02:11,070 --> 00:02:13,290
We want to take this Halo label.

43
00:02:14,890 --> 00:02:21,400
And we want to kind of erase it, right, so we can do this a couple of different ways, there's a function

44
00:02:21,400 --> 00:02:24,400
called Grid Forget and there's a function called destroy.

45
00:02:24,400 --> 00:02:26,140
Now, destroy destroys the thing.

46
00:02:26,140 --> 00:02:27,490
It just removes it completely.

47
00:02:27,730 --> 00:02:30,000
Grid forget hights it.

48
00:02:30,010 --> 00:02:31,120
So we'll look at both of them.

49
00:02:31,330 --> 00:02:36,460
A I usually use a grid forget and that just kind of hides it for a while and then we can bring it back

50
00:02:36,460 --> 00:02:37,450
later if we want to.

51
00:02:37,750 --> 00:02:41,800
This works also with PAC, there's a PAC forget as well, so it works the same way.

52
00:02:42,040 --> 00:02:44,050
But we're looking at grid right now, so let's go.

53
00:02:44,830 --> 00:02:45,520
Hello.

54
00:02:45,520 --> 00:02:51,310
Underscore label dot grid underscore forget.

55
00:02:51,520 --> 00:02:53,500
And this is a function so we just have to do that.

56
00:02:53,710 --> 00:02:57,850
Now if we save this, this is not likely to work and let's run this and see why.

57
00:02:57,850 --> 00:02:58,870
So if we were on this again.

58
00:03:01,110 --> 00:03:07,620
Here we can type in, John, if we submit boom and put it on the screen, if we click here, nothing

59
00:03:07,620 --> 00:03:09,900
happened and if we click exit here.

60
00:03:09,900 --> 00:03:14,460
Now we're getting this this er and it says hello label is not defined.

61
00:03:14,580 --> 00:03:15,810
And this is a scope issue.

62
00:03:15,810 --> 00:03:22,350
If you're familiar with Python or any programming in here, in this function, we created a local variable

63
00:03:22,350 --> 00:03:24,470
and it will only work in this function.

64
00:03:24,480 --> 00:03:29,970
So to try and call something and do something with it in this function, it doesn't work because this

65
00:03:29,970 --> 00:03:31,980
function doesn't know what that is.

66
00:03:31,990 --> 00:03:33,410
So we can change this.

67
00:03:33,480 --> 00:03:34,920
We can fix this a bunch of different ways.

68
00:03:34,920 --> 00:03:39,750
We can try, for instance, calling Global Hello label like that.

69
00:03:39,870 --> 00:03:41,850
If we save this, this may or may not work.

70
00:03:41,850 --> 00:03:42,720
Let's give it a try.

71
00:03:44,980 --> 00:03:50,140
So we can type something, click submit now if we click here, boom, it disappears, so that's one

72
00:03:50,140 --> 00:03:52,410
way to do it and that will usually work.

73
00:03:52,420 --> 00:03:53,760
And let's run this again.

74
00:03:55,260 --> 00:04:01,240
And play with this, so if we now type in John Elder, if we click, submit, boom, hello, John click

75
00:04:01,380 --> 00:04:02,620
boom there goes clear.

76
00:04:02,790 --> 00:04:09,890
Now, if we change this to Tim when it calls it back again, so even though we're hiding it, it's hidden.

77
00:04:10,020 --> 00:04:14,130
And then when we run the function again and it creates that label again, it puts a different thing

78
00:04:14,130 --> 00:04:14,730
on the screen.

79
00:04:14,730 --> 00:04:15,840
So that's grid.

80
00:04:15,840 --> 00:04:18,620
Forget using a button explicitly.

81
00:04:18,900 --> 00:04:26,220
You can also, like I mentioned, use, destroy and it does not the same thing, but it will delete

82
00:04:26,220 --> 00:04:29,490
it, destroy, kill it completely and no longer exists.

83
00:04:29,610 --> 00:04:31,980
For all intents and purposes though, that's kind of the same thing.

84
00:04:31,980 --> 00:04:32,330
Right.

85
00:04:32,700 --> 00:04:40,970
So we can go John, submit boom changes to Elder, bring it back, boom.

86
00:04:40,980 --> 00:04:47,310
So, you know, it kind of works in the same way for the most part, but it's just slightly different.

87
00:04:47,310 --> 00:04:51,170
And there are times when you may want to destroy a thing completely and that's how you do that.

88
00:04:51,180 --> 00:04:53,490
So that's how to do that with a button.

89
00:04:53,940 --> 00:04:55,860
But maybe we don't want to use a button.

90
00:04:55,860 --> 00:05:02,550
Maybe we want to create underscore, forget right off the bat when we click the button so we don't have

91
00:05:02,550 --> 00:05:07,650
to click a clear button, maybe when we type of thing and again the second time and just do it, maybe

92
00:05:07,650 --> 00:05:11,520
we want it to, you know, delete itself at that point.

93
00:05:11,550 --> 00:05:13,350
Well, I think we'll look at that in the next video.
