1
00:00:01,550 --> 00:00:07,310
OK, this video I want to show you to open files with Quinter, so we're going to do something on an

2
00:00:07,310 --> 00:00:10,220
open dialogue box, open file dialogue box.

3
00:00:10,220 --> 00:00:12,710
So I've created a new file called Opened Up Pie.

4
00:00:12,710 --> 00:00:17,150
And you'll notice that the beginning here, I put the same image importing stuff that we've been doing

5
00:00:17,150 --> 00:00:19,670
in the past because we're going to open an image file.

6
00:00:19,880 --> 00:00:21,320
So we're going to need to deal with the images.

7
00:00:21,350 --> 00:00:30,290
So to create an open dialogue and open dialogue box or an open file dialog box, we first need to import

8
00:00:30,290 --> 00:00:32,120
another thing from Kent.

9
00:00:32,270 --> 00:00:39,280
So we go from T Hinter import file dialog.

10
00:00:39,920 --> 00:00:43,630
So this is a file dialog box, so we need to import that.

11
00:00:43,820 --> 00:00:47,480
So down here we can just call route dot file name.

12
00:00:49,180 --> 00:00:54,460
Because we want to grab the file name of some file to open, right, and to get this, we want to open

13
00:00:54,460 --> 00:00:58,420
a little file dialog box, you know, on Windows, when you open a file in a little box, pops up,

14
00:00:58,420 --> 00:01:02,500
it has a list, all your files and you select which one you want to open, click open.

15
00:01:02,740 --> 00:01:04,150
We need to create that thing.

16
00:01:04,160 --> 00:01:08,080
So that is a file dialog.

17
00:01:09,370 --> 00:01:17,500
And now we want to ask open file name, right, and this is a function now we've got to designate a

18
00:01:17,500 --> 00:01:18,270
whole bunch of stuff here.

19
00:01:18,280 --> 00:01:27,610
So the first thing we need to do is tell it what initial directory to look in so we can go initial these

20
00:01:27,790 --> 00:01:31,090
are equals and then just designate what?

21
00:01:31,100 --> 00:01:33,920
So if you just want the C drive, that would be a foregone.

22
00:01:33,970 --> 00:01:34,240
Right.

23
00:01:34,510 --> 00:01:36,990
If you want we're in argues directory.

24
00:01:37,210 --> 00:01:38,250
We could just do that.

25
00:01:38,290 --> 00:01:38,590
Right.

26
00:01:38,950 --> 00:01:42,460
So now we want to give the box that pops up a little title.

27
00:01:42,490 --> 00:01:42,850
Right.

28
00:01:43,030 --> 00:01:44,850
And this can really be anything.

29
00:01:44,860 --> 00:01:45,900
It doesn't really matter.

30
00:01:46,180 --> 00:01:52,660
I'm just going to say open an image file, I don't know, whatever.

31
00:01:53,860 --> 00:01:54,830
So that'll work there.

32
00:01:55,090 --> 00:02:01,450
Now we have to designate the types of files that will allow our program to open, or at least that will

33
00:02:01,450 --> 00:02:04,480
allow it to show on the screen in that little box that pops up.

34
00:02:04,480 --> 00:02:04,660
Right.

35
00:02:04,680 --> 00:02:09,490
So, for instance, in our thing right here, we have.

36
00:02:10,430 --> 00:02:13,730
This Panji file, we also have an icon file.

37
00:02:13,760 --> 00:02:15,530
We also have a bunch of pie files.

38
00:02:15,980 --> 00:02:23,210
So these are the different file types dot pie, dot, Icko, Dot, PMG, looks like a runaway ruby file

39
00:02:23,210 --> 00:02:23,420
in there.

40
00:02:23,430 --> 00:02:29,360
I'm not sure how that got there, but we need to tell our program what images or what file types we

41
00:02:29,360 --> 00:02:31,640
want to be allowed open.

42
00:02:31,640 --> 00:02:31,950
Right.

43
00:02:32,150 --> 00:02:33,740
So we want PMG files.

44
00:02:33,740 --> 00:02:36,400
I'll show you how to do just all files as well.

45
00:02:36,740 --> 00:02:39,410
So to do that, we call file types.

46
00:02:42,900 --> 00:02:48,330
And set that equal to this sort of tuple thing here and now.

47
00:02:49,330 --> 00:02:58,090
It's for each thing we want to open, we need another set of parentheses, right, so inside of here,

48
00:02:58,270 --> 00:02:59,640
we need to give it a little message.

49
00:02:59,650 --> 00:03:02,230
Let's call this PG philes.

50
00:03:05,180 --> 00:03:09,830
And this really doesn't matter what it is, it's just a little message that pops up and I'll show you

51
00:03:09,830 --> 00:03:11,390
in a second what I mean by that.

52
00:03:11,600 --> 00:03:16,880
And in the second thing here inside of this second tube wall here, we need to designate the type of

53
00:03:16,880 --> 00:03:17,270
file.

54
00:03:17,270 --> 00:03:24,860
So you start out usually always with Star and then Dot PMG because we want to open PMG files.

55
00:03:24,890 --> 00:03:31,100
Now the star means open anything that ends in PNG stars like a wild card.

56
00:03:31,100 --> 00:03:36,470
So any file we have, the ends in PNG will show up.

57
00:03:37,220 --> 00:03:38,240
OK, so that's that.

58
00:03:38,510 --> 00:03:43,730
If you want to do more than just one thing, if you want also JPEG files, you just put a comma and

59
00:03:43,730 --> 00:03:47,150
then put another tuple and then here give you a little message.

60
00:03:47,150 --> 00:03:52,910
You can say, you know, JPEG files or whatever, and then you would put Stadt jpeg instead.

61
00:03:52,910 --> 00:03:54,140
Let's go all files.

62
00:03:55,220 --> 00:04:06,430
And inside here, we want any file with any names, so star that ends and got any extension, so OK,

63
00:04:06,650 --> 00:04:12,230
I think that is that now I put a bunch of spaces here, you don't have to actually put any spaces.

64
00:04:12,230 --> 00:04:16,700
I just thought it would be easier to sort of read the different sections of this.

65
00:04:17,270 --> 00:04:22,430
So, OK, now we can just run this if we save this and run it.

66
00:04:24,080 --> 00:04:32,940
Come back here and run, opened up high, and you could see right away it just opened this thing and

67
00:04:32,940 --> 00:04:34,460
now I'm in my guv's directory.

68
00:04:34,470 --> 00:04:36,450
This is the open file dialogue box.

69
00:04:36,450 --> 00:04:37,860
Here's the title at the top.

70
00:04:37,860 --> 00:04:42,090
Open an image file and we can see Assman PMG down here.

71
00:04:42,090 --> 00:04:43,460
It says PMG Files.

72
00:04:43,470 --> 00:04:46,320
That's the little thing that we typed.

73
00:04:47,440 --> 00:04:55,840
And let's see right right here, this PNG file, we also typed all files, so if we come back here.

74
00:04:56,750 --> 00:05:00,600
And down we could see it also says all files, if I type Bob there.

75
00:05:00,620 --> 00:05:04,740
It would show up as Bob and then Starr PMG.

76
00:05:04,760 --> 00:05:08,690
Right, but we type PMG files and all of us, we click all files, boom.

77
00:05:08,690 --> 00:05:12,380
It changes to all of the files in our directory.

78
00:05:12,670 --> 00:05:15,020
There's our Aspen, there's our all of our programs.

79
00:05:15,020 --> 00:05:16,040
There's that icon.

80
00:05:16,370 --> 00:05:19,280
There's that runaway ruby file that I'm not sure why it's in there.

81
00:05:19,610 --> 00:05:21,230
And so very cool so that we can click on this.

82
00:05:21,230 --> 00:05:22,790
And when we do, nothing happens.

83
00:05:23,030 --> 00:05:27,770
And here's our original file thing, and this video is getting a little bit long.

84
00:05:27,770 --> 00:05:33,650
In the next video, I'll show you how to actually open an image once we've selected it from that box.

85
00:05:33,950 --> 00:05:39,020
And we'll clean this up and make this to where it doesn't just throw the box when the program runs,

86
00:05:39,230 --> 00:05:43,400
we'll click a button or something to do that and we'll look at that in the next video.
