1
00:00:02,010 --> 00:00:06,690
OK, in this video, I want to look at images and images are a little bit more complicated than the

2
00:00:06,690 --> 00:00:13,170
things we've done so far, and that's because Kintyre comes with sort of an image library system.

3
00:00:13,470 --> 00:00:17,160
But it's way outdated, doesn't work very well at all, and we don't want to use it.

4
00:00:17,170 --> 00:00:21,480
So we need to kind of install and use a different image thing.

5
00:00:21,720 --> 00:00:23,910
And the thing we're going to use is something called Pelo.

6
00:00:24,150 --> 00:00:27,630
It was originally called PILT pill, but it's very old.

7
00:00:27,630 --> 00:00:31,600
And now there's an updated version called Pelo, and that's what we're going to use.

8
00:00:31,620 --> 00:00:36,030
So we actually have to install this in our terminal in order to use it.

9
00:00:36,040 --> 00:00:40,570
And you only have to install it once, but it has to be there in order to work.

10
00:00:40,590 --> 00:00:46,350
So now if we go back to our terminal, if we type in pip freeze, we can see the things that are already

11
00:00:46,350 --> 00:00:48,180
installed in our virtual environment.

12
00:00:48,180 --> 00:00:51,270
And there's nothing listed there because we don't have anything installed yet.

13
00:00:51,570 --> 00:00:52,760
But that's going to change now.

14
00:00:52,770 --> 00:00:52,990
So.

15
00:00:52,990 --> 00:00:56,340
So to install things, you go pip install and then name the thing.

16
00:00:56,350 --> 00:01:03,420
So we want to install Pelo capital PLL O.W. and it's collecting, downloading and just stands for Python

17
00:01:03,420 --> 00:01:04,460
installation program.

18
00:01:04,740 --> 00:01:09,000
It should just work automatically to make sure you're in your directory, make sure you have your virtual

19
00:01:09,000 --> 00:01:09,970
environment turned on.

20
00:01:10,260 --> 00:01:16,350
So if we click on the screen and now if we type in pip freeze, we see that Pelo version seven point

21
00:01:16,350 --> 00:01:17,850
zero has been installed.

22
00:01:17,850 --> 00:01:21,930
If that version changes by the time you watch this, no big deal at all, just install the latest one.

23
00:01:21,960 --> 00:01:23,190
So now that's good to go.

24
00:01:23,200 --> 00:01:24,810
We don't ever have to install that again.

25
00:01:24,810 --> 00:01:27,230
As long as we're in our virtual environment, it will work.

26
00:01:27,810 --> 00:01:30,090
Now we have to import it up here.

27
00:01:30,390 --> 00:01:33,140
So we're going to go from PLL.

28
00:01:33,180 --> 00:01:39,660
Now, I know we just installed Pelo, but the convention is to call a capital P Capital I capital l

29
00:01:39,810 --> 00:01:40,220
l.

30
00:01:40,470 --> 00:01:43,080
So we want to import and then.

31
00:01:44,320 --> 00:01:50,710
Image, Teekay, its capital I and Capital T, and we also want to install something called image.

32
00:01:51,750 --> 00:01:58,200
So these two things now will allow us to use images in our counterprogram, so I've come down here and

33
00:01:58,200 --> 00:02:02,450
I've just had a little comment at the top here above our labels that says ad images.

34
00:02:02,460 --> 00:02:07,190
Now, it's a little bit different process to create an image than it is our other widgets.

35
00:02:07,200 --> 00:02:10,770
And that's because you can add images to almost any widget.

36
00:02:10,770 --> 00:02:15,540
So your label widget, you can have an image of buttons, you can add an image into an image to just

37
00:02:15,540 --> 00:02:16,100
about everything.

38
00:02:16,110 --> 00:02:18,450
So we're not going to add an image.

39
00:02:18,460 --> 00:02:20,520
We're going to add an image to something else.

40
00:02:20,640 --> 00:02:22,610
So first, we just have to define the image.

41
00:02:22,620 --> 00:02:26,910
So let's go my underscore image and set this equal to now.

42
00:02:26,910 --> 00:02:37,170
This is an image, t.K, and that's just because we imported this up here and then got photo image.

43
00:02:39,450 --> 00:02:45,330
Capital P and capital I write, so this is like the widget we're using, but since we have to import

44
00:02:45,330 --> 00:02:49,200
this, we slap a imagistic on top of it, dot photo image.

45
00:02:49,230 --> 00:02:54,230
OK, so now instead of here, we call image dot open.

46
00:02:54,240 --> 00:02:59,730
So we want to open this image and now just define what you want to open.

47
00:02:59,760 --> 00:03:07,350
So I've got an image called Aspen Dot jpeg and I'm going to go back over here and open our file explorer

48
00:03:07,350 --> 00:03:07,700
again.

49
00:03:07,710 --> 00:03:13,410
I just went to Windows Start menu and typed in file and this icon popped up navigate to your directory.

50
00:03:13,470 --> 00:03:17,490
So here and Siegfried's you could see here are held up by Filer's, that icon.

51
00:03:17,670 --> 00:03:21,870
And I've just pasted this Aspendale PMG file inside of here.

52
00:03:21,870 --> 00:03:25,440
And if you take a quick look at this, this is just the picture is just a goofy picture of me and my

53
00:03:25,440 --> 00:03:29,400
dog, Aspen, the hurricane Siberian husky, who is.

54
00:03:30,410 --> 00:03:31,640
Adorable and crazy.

55
00:03:32,010 --> 00:03:41,030
All right, so now we've got this, and you'll notice when we talked about icons, I put this see agoutis

56
00:03:41,660 --> 00:03:45,640
and then the file name, we could do that same thing down here.

57
00:03:46,310 --> 00:03:51,400
But since this is in the same directory that our program is running in, we don't have to do that.

58
00:03:51,410 --> 00:03:53,250
And in fact, we probably didn't have to do it up here.

59
00:03:53,270 --> 00:03:56,250
I just wanted to show you explicitly how to do it.

60
00:03:56,570 --> 00:03:58,810
So, OK, we've now defined this thing.

61
00:03:59,180 --> 00:04:02,060
Now, in order to use this, we need to create some sort of label.

62
00:04:02,300 --> 00:04:12,500
So let's go and let's just call this image underscore label and set that equal to a label like any other

63
00:04:12,500 --> 00:04:12,950
label.

64
00:04:13,930 --> 00:04:19,660
And then inside of here, instead of putting rude and text like we've done with other labels, we just

65
00:04:19,660 --> 00:04:25,600
type an image and then set that equal to this image we just defined as variable.

66
00:04:28,500 --> 00:04:34,260
So now we can just pack this to the screen so we can go image label, dot pack or grid or whatever you

67
00:04:34,260 --> 00:04:34,800
want to do.

68
00:04:35,010 --> 00:04:42,750
And if we save this now, if we come back over here and run our program again, oh, oh, asp.net PMG.

69
00:04:43,740 --> 00:04:46,380
Not a jpeg, it's a PG file.

70
00:04:47,310 --> 00:04:49,140
Deu All right.

71
00:04:49,150 --> 00:04:51,540
So now save this and run it.

72
00:04:53,090 --> 00:04:54,080
And boom, we get.

73
00:04:55,780 --> 00:04:57,940
This image, you see our programs.

74
00:05:00,600 --> 00:05:05,130
And you can see our programs getting a little bigger than what we've defined, but anyway, there's

75
00:05:05,130 --> 00:05:08,850
our image and you can use all the same label things as you did before.

76
00:05:08,850 --> 00:05:14,880
You know, if you want to give this a border or make it sunk in or, you know, anything like that,

77
00:05:14,880 --> 00:05:18,570
you can do that and pretty cool and not too not too difficult.

78
00:05:18,600 --> 00:05:21,570
So, like I said, a little bit harder to do than a regular widget.

79
00:05:21,870 --> 00:05:25,920
So we have to do as pip install our image things, then import PILT.

80
00:05:26,370 --> 00:05:30,270
Now sometimes people have trouble with importing PILT.

81
00:05:30,480 --> 00:05:35,790
If you're on Macra Linux, you may come into some you may have some trouble if you're on a different

82
00:05:35,790 --> 00:05:39,030
version of Windows, an older version of Windows, you may have trouble importing this.

83
00:05:39,240 --> 00:05:40,530
You're just going to have to Google it.

84
00:05:40,530 --> 00:05:42,270
If that happens, it doesn't happen all the time.

85
00:05:42,270 --> 00:05:46,470
But I have had students come to me and say I'm trying to import pill and it just won't work.

86
00:05:48,350 --> 00:05:55,240
You just have to Google, you know, whatever version of Mac you're on and import PILT Python and you'll

87
00:05:55,240 --> 00:05:58,570
get a little thing that shows you exactly how to do it, but you should be OK.

88
00:05:58,810 --> 00:06:03,580
And you can always ask me right here if you if you have trouble yourself and I'll try and walk you through

89
00:06:03,580 --> 00:06:04,460
it and we'll figure it out.

90
00:06:04,990 --> 00:06:06,280
So that's how to do image.

91
00:06:06,300 --> 00:06:07,060
It's not too hard.

92
00:06:07,210 --> 00:06:10,570
In the next video, we'll look at hiding and showing things.
