1
00:00:01,860 --> 00:00:09,200
OK, we're moving right along now, we just click the save to PNG thing we typed in Bob PNG and I'll

2
00:00:09,390 --> 00:00:10,320
pay attention to this.

3
00:00:10,320 --> 00:00:11,400
This is kind of important here.

4
00:00:11,410 --> 00:00:17,310
So if I type Bob PMG and then click save like we did in the last video, this is what we get.

5
00:00:17,550 --> 00:00:17,840
Right.

6
00:00:18,090 --> 00:00:21,210
Let's close this and run it again though, and let's do this again.

7
00:00:21,210 --> 00:00:22,620
Saved PNG this time.

8
00:00:22,630 --> 00:00:30,560
I'm just going to type Bob right now and I click save it outputs Bob now we need it to say Bob PNG.

9
00:00:30,810 --> 00:00:36,690
Now you and I know we need to type that PNG because we're saving this as a PNG image file.

10
00:00:37,170 --> 00:00:41,160
Your ordinary average person isn't going to know that necessarily.

11
00:00:41,340 --> 00:00:43,860
And they may not type Bob PNG.

12
00:00:43,920 --> 00:00:47,490
It might just type Bob or they just might type my image or whatever.

13
00:00:48,210 --> 00:00:53,130
But we need to make sure it says, Bob, PNG can't go forward unless it says dot PNG.

14
00:00:53,130 --> 00:00:58,860
So let's write a little code just to make sure even if they forget to type to be PNG or they don't know

15
00:00:58,860 --> 00:01:02,820
they need to, it will still end up being PNG.

16
00:01:02,820 --> 00:01:06,860
So we can basically ask, hey, what did it end with?

17
00:01:07,080 --> 00:01:07,290
Right.

18
00:01:07,380 --> 00:01:11,280
And we can do that by calling result dot ends with.

19
00:01:12,190 --> 00:01:14,660
And then passing that PNG.

20
00:01:15,650 --> 00:01:22,520
Now, this will essentially ask, does result end with PNG and it will return true or false?

21
00:01:22,820 --> 00:01:25,700
So now we can do an if statement, just a basic python if statement.

22
00:01:25,710 --> 00:01:26,780
So let's go if.

23
00:01:27,980 --> 00:01:29,790
Result ends with PNG.

24
00:01:30,380 --> 00:01:34,660
Don't do anything for now, we'll just we'll just pass if it ends in PNG, we're good.

25
00:01:34,670 --> 00:01:35,630
We don't need to do anything.

26
00:01:35,900 --> 00:01:38,600
But if it doesn't, else, well, then let's change it.

27
00:01:38,600 --> 00:01:39,800
To add PNG.

28
00:01:39,800 --> 00:01:41,120
We can add it ourselves right now.

29
00:01:41,120 --> 00:01:41,600
So let's go.

30
00:01:41,610 --> 00:01:45,620
Result equals result plus.

31
00:01:46,490 --> 00:01:48,960
And then we could just add that PNG ourselves.

32
00:01:49,550 --> 00:01:50,420
So now.

33
00:01:51,410 --> 00:01:53,750
And let's actually put this underneath.

34
00:01:55,250 --> 00:01:56,420
And let's test this out.

35
00:01:58,930 --> 00:02:07,390
So if they type in PNG, don't do anything, if they don't type in PNG, added ourselves and then print

36
00:02:07,390 --> 00:02:09,250
it out to the screen, so let's save this and run it.

37
00:02:14,420 --> 00:02:18,430
And let's save to PNG and let's go Bob, PNG.

38
00:02:18,590 --> 00:02:19,610
We did this before.

39
00:02:20,490 --> 00:02:24,530
OK, it prints out, Bob, that being that worked, let's run it again.

40
00:02:26,570 --> 00:02:32,520
This time, let's save it just to Bob, oops, we forgot to type in the pink ourselves.

41
00:02:32,810 --> 00:02:33,590
Click Save.

42
00:02:33,770 --> 00:02:37,430
It's still prints out Bob that PG because we're adding the pink ourselves.

43
00:02:37,670 --> 00:02:43,220
So now we've saved the day whether the person is smart or stupid or not, just stupid.

44
00:02:43,220 --> 00:02:44,990
But that's what I'm looking for.

45
00:02:44,990 --> 00:02:45,440
Ignorant.

46
00:02:45,440 --> 00:02:47,340
They don't know they need to type in PNG.

47
00:02:47,960 --> 00:02:50,660
This will make sure it gets saved as PNG anyway.

48
00:02:50,920 --> 00:02:52,790
OK, so we can get rid of this result label.

49
00:02:52,790 --> 00:02:54,500
We don't have to actually print this on the screen.

50
00:02:54,500 --> 00:03:00,800
I just did it to show you what this whole file dialogue box is returning any time you fill it out.

51
00:03:00,920 --> 00:03:04,760
And it also helped us er handle this thing right here, which we definitely need to keep.

52
00:03:05,000 --> 00:03:12,320
So OK, we're almost there where we've got our file name, we've got the extension correct.

53
00:03:13,490 --> 00:03:17,870
Now all we have to do is actually save the file and we'll start to look at that in the next video.
