1
00:00:01,560 --> 00:00:10,080
OK, so we've got this brush size slider and we can move it around, but what what size is this right

2
00:00:10,080 --> 00:00:10,600
now?

3
00:00:10,920 --> 00:00:11,520
We don't know.

4
00:00:11,520 --> 00:00:12,600
How big is this?

5
00:00:12,600 --> 00:00:13,670
How big is this like?

6
00:00:13,680 --> 00:00:14,280
We don't know.

7
00:00:14,460 --> 00:00:19,890
So let's create a little label inside of here that shows us exactly what size it is whenever we're moving

8
00:00:19,890 --> 00:00:20,820
this thing around.

9
00:00:21,060 --> 00:00:22,380
So let's do that real quick.

10
00:00:23,360 --> 00:00:31,310
So let's head back over to our code and let's create another comment here and let's go brush slider

11
00:00:31,310 --> 00:00:35,210
label and let's call this slider underscore label.

12
00:00:37,450 --> 00:00:43,180
And that's going to be a label this is a label widget, and we where do we want to put this where we

13
00:00:43,180 --> 00:00:50,110
want to put it in this frame, this brush size frame that we put that there and we want the tax to equal

14
00:00:50,380 --> 00:00:51,940
whatever the slider is.

15
00:00:52,150 --> 00:00:53,370
So what do we call our slider?

16
00:00:53,380 --> 00:00:57,640
We call it my slider so we can just set it equal to my slider doget.

17
00:00:57,850 --> 00:00:58,990
And this is a function.

18
00:00:59,120 --> 00:01:03,450
So this will get whatever the slider happens to be at the moment.

19
00:01:03,490 --> 00:01:03,740
Right.

20
00:01:04,000 --> 00:01:10,300
So now we can slider underscore label, dot pack and that should be fine.

21
00:01:10,450 --> 00:01:15,430
We could give it a pad y of, I don't know, five or something to push it down a little bit and say

22
00:01:15,440 --> 00:01:15,670
this.

23
00:01:15,670 --> 00:01:16,240
Let's run it.

24
00:01:16,250 --> 00:01:18,250
Let's take a look at this, because this is going to be interesting.

25
00:01:19,410 --> 00:01:20,400
So if we run this.

26
00:01:22,010 --> 00:01:29,510
We see it's at 10 because remember, when we define this thing way back here, we set the value, the

27
00:01:29,510 --> 00:01:30,980
default value at 10.

28
00:01:32,900 --> 00:01:35,060
So it's ten now, but if we move this.

29
00:01:36,630 --> 00:01:39,680
It's not updating, so we need to change that.

30
00:01:39,990 --> 00:01:45,630
So you remember when we created the slider, we gave it a command of change brush size.

31
00:01:45,810 --> 00:01:49,590
So we have that function up here and we haven't actually done anything with it.

32
00:01:49,600 --> 00:01:51,860
Now we just put past for now.

33
00:01:52,260 --> 00:01:57,030
One thing I will mention right now, hit the tab button on your keyboard to tab over.

34
00:01:57,240 --> 00:01:59,280
Do not hit the space bar a bunch of times.

35
00:01:59,280 --> 00:02:00,030
Python.

36
00:02:00,600 --> 00:02:05,220
Python is tab sensitive, so you have to actually tab over for functions.

37
00:02:05,490 --> 00:02:11,150
So now we can actually come down here and grab this slider label that we just created.

38
00:02:11,160 --> 00:02:14,220
Come up here and let's go slide relator label.

39
00:02:14,220 --> 00:02:15,480
Dot config.

40
00:02:16,880 --> 00:02:22,490
And so the text equal to that same thing we just did down here, my slider doget.

41
00:02:24,850 --> 00:02:30,970
And we can pass that in now, any time this function gets called, which is any time the slider moves,

42
00:02:31,100 --> 00:02:37,270
it will update this label with whatever the current position is from my slider, not get let's go and

43
00:02:37,270 --> 00:02:39,300
save this and let's run this guy again.

44
00:02:41,620 --> 00:02:42,320
Now, check this out.

45
00:02:42,340 --> 00:02:46,480
This is kind of weird if we do this, it's still not moving.

46
00:02:46,600 --> 00:02:49,860
And that's because, remember, this is all these errors we got earlier.

47
00:02:50,200 --> 00:02:55,210
It's saying our brush size function takes zero positional arguments, but one was given.

48
00:02:55,600 --> 00:02:56,470
What does that mean?

49
00:02:56,710 --> 00:03:03,010
Well, if we look at our code here, usually you pass things into a function and when you create your

50
00:03:03,010 --> 00:03:04,870
slider and.

51
00:03:07,160 --> 00:03:13,970
This brush size function gets called the widget is actually passing its current position, sort of like

52
00:03:13,970 --> 00:03:15,300
its event, right.

53
00:03:15,380 --> 00:03:17,810
Like we did earlier when we passed in this E!

54
00:03:18,980 --> 00:03:25,520
Right, so it's passing that information in, but we haven't actually programmed it to accept that,

55
00:03:25,520 --> 00:03:25,760
right.

56
00:03:25,940 --> 00:03:28,010
We haven't put anything here so we can do anything we want.

57
00:03:28,040 --> 00:03:29,150
I could just type in thing.

58
00:03:29,150 --> 00:03:33,320
We're just going to pass a thing and we're not actually ever going to use it in here, but we still

59
00:03:33,320 --> 00:03:35,710
have to account for it by putting that there.

60
00:03:35,720 --> 00:03:38,000
So if we save this now, if we come back here.

61
00:03:39,290 --> 00:03:40,550
Run this again.

62
00:03:42,250 --> 00:03:46,900
And move this around, you'll see as we move this, it changes.

63
00:03:46,930 --> 00:03:48,220
Now check this out.

64
00:03:48,250 --> 00:03:52,990
Eighty six point one eight six oh four, that's a long decimal number.

65
00:03:53,140 --> 00:03:56,050
And in Python, decimals are called floats.

66
00:03:56,260 --> 00:03:58,360
And we don't actually want to float here.

67
00:03:58,360 --> 00:03:59,440
We just want the integer.

68
00:03:59,440 --> 00:04:00,970
We just wanted to say eighty six.

69
00:04:00,970 --> 00:04:06,160
We don't really care that it's eighty six point one eight or seventy point zero six or whatever.

70
00:04:06,400 --> 00:04:08,230
We you know, this is just too sloppy.

71
00:04:08,230 --> 00:04:09,430
So how can we change that?

72
00:04:09,430 --> 00:04:16,030
We can do that really easily by heading over here and instead of just passing that whole float, we

73
00:04:16,030 --> 00:04:24,610
can actually convert this to the integer just by calling some quotation marks and let's go percent.

74
00:04:25,560 --> 00:04:30,450
Zero point zero F and then we want to pass in.

75
00:04:32,760 --> 00:04:35,220
Let's convert this from a to a float.

76
00:04:36,320 --> 00:04:38,090
And like that.

77
00:04:39,500 --> 00:04:46,790
And so this this little guy right here will take this and sort of swap out for this and turn it into

78
00:04:46,790 --> 00:04:51,880
an integer so it'll get rid of the decimals zero point zero.

79
00:04:52,160 --> 00:04:57,080
So if we save this and it's run this guy again, we may have to do this twice, let's say, here.

80
00:04:59,170 --> 00:05:00,640
Now and that works.

81
00:05:01,000 --> 00:05:05,620
So now it's say seventy seven, ninety four, seventy, sixty, etc..

82
00:05:06,120 --> 00:05:06,730
OK, so.

83
00:05:07,680 --> 00:05:13,680
We're still not changing the actual brush size when we change this yet, so let's go ahead and do that

84
00:05:13,680 --> 00:05:14,210
real quick.

85
00:05:14,790 --> 00:05:22,830
So if we look at our paint function where we're actually drawing on the screen, remember, we're passing

86
00:05:22,830 --> 00:05:24,570
the width of brush with.

87
00:05:25,410 --> 00:05:31,320
And that is just we put it at 20 instead of putting it at 20.

88
00:05:32,720 --> 00:05:35,810
We can actually just grab this thing right here.

89
00:05:38,020 --> 00:05:44,770
And copy it and just put it right there, the same thing here, we're changing it from the float to

90
00:05:44,770 --> 00:05:48,600
whatever that is and where my slider getting that from the slider.

91
00:05:49,060 --> 00:05:51,280
And if we just save this, this should now work.

92
00:05:51,690 --> 00:05:53,130
Let's come back here and run this again.

93
00:05:57,290 --> 00:06:00,280
That's pretty small, you can change it to 68.

94
00:06:01,040 --> 00:06:05,090
It's pretty big, you go all the way down to one very small.

95
00:06:06,210 --> 00:06:09,110
All the way up to one hundred room, very big, right?

96
00:06:09,160 --> 00:06:10,800
So, all right, just like that.

97
00:06:12,310 --> 00:06:17,900
That works, so that's how we change the brush size pretty is pretty straightforward.

98
00:06:17,900 --> 00:06:20,670
It took us a few videos to get there, but it was all pretty simple.

99
00:06:21,310 --> 00:06:25,510
The only weird thing about this really was.

100
00:06:26,860 --> 00:06:32,170
This thing right here, this is just basic python here where we're converting from a float, we're just

101
00:06:32,170 --> 00:06:35,980
changing the format of it, using this sort of substitution thing here.

102
00:06:36,340 --> 00:06:36,670
Right.

103
00:06:36,940 --> 00:06:37,990
And that's all there is to it.

104
00:06:38,230 --> 00:06:38,530
All right.

105
00:06:38,530 --> 00:06:40,960
So we've got our brush with done in the next video.

106
00:06:40,970 --> 00:06:42,070
We'll look at brush type.
