1
00:00:01,580 --> 00:00:06,450
OK, in this video, we're going to start to work on the save as P and G function.

2
00:00:06,470 --> 00:00:09,890
Now, this is going to take us a few videos because it's not hard.

3
00:00:09,890 --> 00:00:12,140
It's just a lots of moving pieces to this.

4
00:00:12,170 --> 00:00:17,030
So the first thing we want to do when we click that button, we want a box to pop up and we want it

5
00:00:17,030 --> 00:00:21,330
to be the the traditional save dialog box that you see in any program.

6
00:00:21,350 --> 00:00:27,110
So, for instance, if we click here, file save, as you see this box pops up the save as box and we

7
00:00:27,110 --> 00:00:32,360
can then name our file and save it when we want that sort of thing to pop up because people are familiar

8
00:00:32,360 --> 00:00:32,720
with that.

9
00:00:32,720 --> 00:00:33,010
Right.

10
00:00:33,020 --> 00:00:39,500
So fortunately, Kintore has a thing that allows us to to use one of those pop up boxes with a save

11
00:00:39,500 --> 00:00:40,250
dialog.

12
00:00:40,610 --> 00:00:41,780
And it's pretty simple.

13
00:00:41,780 --> 00:00:43,040
We just need to import it.

14
00:00:43,040 --> 00:00:46,420
So that thing is called a file dialog box.

15
00:00:46,440 --> 00:00:46,730
Right.

16
00:00:46,730 --> 00:00:48,740
So we can just from Kintner.

17
00:00:50,110 --> 00:00:50,980
Import.

18
00:00:53,020 --> 00:01:01,600
File dialogue, so this will allow us to use the file dialogue widget thing that comes with Kenta so

19
00:01:01,640 --> 00:01:07,590
that we can come back down here to our save as page function and let's create a variable called result.

20
00:01:07,630 --> 00:01:10,160
This is the resulting file name that we're going to create.

21
00:01:10,390 --> 00:01:15,100
So to get the file name that we want, let's go file dialogue.

22
00:01:15,850 --> 00:01:19,930
And then the file dialogue has several different functions in it.

23
00:01:20,110 --> 00:01:22,960
And what we want to do is find out a save name.

24
00:01:23,150 --> 00:01:28,690
So we need to ask save as file name.

25
00:01:29,900 --> 00:01:33,350
So ask save as file name, and we just.

26
00:01:35,600 --> 00:01:39,270
With this apart, so you can see asked save as file name, right?

27
00:01:39,980 --> 00:01:41,540
So this back.

28
00:01:43,280 --> 00:01:46,900
Now we can set the initial directory, we want it to show up.

29
00:01:47,150 --> 00:01:52,220
So, for instance, when we come here and click Save, as you can see, I'm in this patent directory,

30
00:01:52,220 --> 00:01:54,140
which is the directory that we're currently in.

31
00:01:54,410 --> 00:01:54,730
Right.

32
00:01:54,770 --> 00:01:58,820
So we can say, hey, where do we want to save this?

33
00:01:58,820 --> 00:02:01,400
Let's just save it in this patent directory.

34
00:02:01,940 --> 00:02:02,840
Or I can.

35
00:02:02,840 --> 00:02:03,020
Right.

36
00:02:03,020 --> 00:02:08,240
Click here and click new folder and let's create a folder or we're going to save our images.

37
00:02:08,930 --> 00:02:14,360
So here now we've got this images in our patent directory where we've been saving our file up until

38
00:02:14,360 --> 00:02:14,630
now.

39
00:02:14,630 --> 00:02:14,990
Right.

40
00:02:15,260 --> 00:02:20,420
And let's save our stuff in there so we can set that as the the default initial directory.

41
00:02:20,600 --> 00:02:23,800
And to do that, we just call initial IIR.

42
00:02:24,730 --> 00:02:31,210
So that's initial in ITIL year and where do we want this to go?

43
00:02:31,240 --> 00:02:37,690
Well, I want this in my C drive in our paint directory, which is the directory we're in and images.

44
00:02:38,630 --> 00:02:44,860
If we look back in our terminal here, we see we're in our sea paint directory and if we type in alst,

45
00:02:44,860 --> 00:02:47,730
we could see we've got this image is directory that we just created.

46
00:02:48,220 --> 00:02:48,480
Right.

47
00:02:49,000 --> 00:02:50,500
So that's where we're at there.

48
00:02:50,750 --> 00:02:54,490
Now, we want to say this is a PG and there are all kinds of different files.

49
00:02:54,490 --> 00:02:59,800
You can save a thing as PNG DJ Pegg's gift's I want PNG.

50
00:02:59,830 --> 00:03:01,480
So we want to define that.

51
00:03:01,480 --> 00:03:05,530
We want to make sure that's the only option they have to choose from, because we want to make sure

52
00:03:05,530 --> 00:03:13,270
we save it as a certain file type so we can call file types and then set that equal to two brackets.

53
00:03:13,720 --> 00:03:18,310
And then instead of here, let's go PNG files, comma.

54
00:03:19,330 --> 00:03:25,230
And then another set of quotation marks and let's go Star Dot PNG.

55
00:03:25,960 --> 00:03:32,680
Now this is going to say allow this, allow us to save this as any name that PNG, the star stands for

56
00:03:32,680 --> 00:03:37,960
anything so we can name this Bob PNG or my picture, not PNG or anything at all.

57
00:03:38,200 --> 00:03:40,560
Dot PNG in this PNG files.

58
00:03:40,570 --> 00:03:41,870
I'll show you what that is in just a second.

59
00:03:41,890 --> 00:03:45,220
That's just a little title that will get printed out.

60
00:03:45,450 --> 00:03:53,620
Well, if we go here, file save as down here it'll say it'll say PNG files down here basically or somewhere

61
00:03:53,620 --> 00:03:54,190
around here.

62
00:03:54,340 --> 00:03:56,950
That's what that is right now.

63
00:03:57,310 --> 00:04:00,210
We also might want to be able to let them save.

64
00:04:00,220 --> 00:04:02,170
It is all file types as well.

65
00:04:02,680 --> 00:04:03,030
Right?

66
00:04:03,130 --> 00:04:10,360
If we if we want that, we can then type in all files, give it a little name, and then here, just

67
00:04:10,360 --> 00:04:12,490
like we want with star PNG.

68
00:04:12,940 --> 00:04:16,500
Well, now we would go star dot star.

69
00:04:16,840 --> 00:04:18,330
Remember, the star means anything.

70
00:04:18,340 --> 00:04:26,320
So this will allow us to do all files, any type of file extension, png, jpeg, icon, gif, anything

71
00:04:26,320 --> 00:04:28,470
you want, BNP, whatever.

72
00:04:28,750 --> 00:04:31,030
So OK, that should work.

73
00:04:31,660 --> 00:04:37,510
So let's go ahead and save this and just run this real quick just to see if that worked.

74
00:04:41,480 --> 00:04:46,700
So now we click save to PNG, the box pops up here, remember, it says PNG files.

75
00:04:46,850 --> 00:04:53,060
That's where we typed in PNG files and we can save anything as dot PNG if we actually click here to

76
00:04:53,570 --> 00:04:54,960
type something and save it.

77
00:04:55,370 --> 00:05:00,080
It doesn't actually save this because we haven't told it to save it yet.

78
00:05:00,080 --> 00:05:02,960
We haven't programmed it to save anything yet, but.

79
00:05:04,000 --> 00:05:14,050
What this is doing, it's returning that name we just typed in, so if I typed Bob PMG result well equal

80
00:05:14,050 --> 00:05:18,730
now Bob Dot PNG and we can actually take a look at this if we want.

81
00:05:18,730 --> 00:05:21,760
Let's go a result underscore label.

82
00:05:22,210 --> 00:05:26,380
And this is a label and we want to just put this in one of the text equal result.

83
00:05:27,620 --> 00:05:32,940
And then let's go result, underscore a label that pack and let's give this a pat, why of 20, just

84
00:05:33,860 --> 00:05:34,640
push it down the screen.

85
00:05:34,640 --> 00:05:37,040
So let's save this and run this guy again.

86
00:05:41,320 --> 00:05:46,060
So saved PMG, I'm going to save this as Bob DCPI, Angie.

87
00:05:49,630 --> 00:05:52,450
We see it's in sea paint images, Bob, PMG.

88
00:05:53,000 --> 00:05:54,930
OK, so now we're coming right along.

89
00:05:55,240 --> 00:06:01,330
We haven't actually saved anything yet, but now we have the directory name and the name of the file

90
00:06:01,330 --> 00:06:01,830
itself.

91
00:06:01,840 --> 00:06:09,310
So now we can now say, hey, save this thing to this place and we'll start to look at that in the next

92
00:06:09,310 --> 00:06:09,700
video.
