1
00:00:01,950 --> 00:00:06,060
OK, in this video, I want to talk about checkboxes in the last minute, we looked at radio buttons,

2
00:00:06,060 --> 00:00:10,920
the round buttons in this video, we're looking at checkboxes, which are square boxes and generally

3
00:00:10,920 --> 00:00:14,250
speaking, checkboxes, allow you to check multiple things.

4
00:00:14,250 --> 00:00:18,120
You can have as many check boxes as you want with the radio buttons.

5
00:00:18,120 --> 00:00:22,700
You're selecting one thing from a list with checkboxes, you can have multiple things selected.

6
00:00:22,950 --> 00:00:26,130
So that's sort of why you want to use one versus the other.

7
00:00:26,130 --> 00:00:26,410
Right.

8
00:00:26,430 --> 00:00:26,700
So.

9
00:00:26,910 --> 00:00:27,840
All right, I've got a file.

10
00:00:27,840 --> 00:00:33,510
I've called it checkbox potpies, just the same sort of starter text that we've been using and the same

11
00:00:33,510 --> 00:00:33,690
deal.

12
00:00:33,690 --> 00:00:35,100
We want to start out by creating a variable.

13
00:00:35,100 --> 00:00:38,670
I'm just going to call it V because I'm lazy and this is a string var.

14
00:00:39,610 --> 00:00:45,940
And we can now create a check box, so let's just call it my check, and this is going to be a check

15
00:00:46,360 --> 00:00:46,980
button.

16
00:00:48,140 --> 00:00:52,260
It's called check button, not checkbox, but because I guess because you click it, but whatever.

17
00:00:52,470 --> 00:00:56,930
And we want to put this in route and we want the techs to equal.

18
00:00:56,970 --> 00:00:57,540
I don't know.

19
00:00:58,380 --> 00:01:00,630
Let's say peperoni.

20
00:01:01,800 --> 00:01:03,450
Pepperoni as well, that right?

21
00:01:03,560 --> 00:01:13,170
Yeah, and again, we want to set the variable to V and now so just like in the last video, we could

22
00:01:13,170 --> 00:01:17,010
have made this an interviewer and then we could have just left it like this.

23
00:01:17,190 --> 00:01:19,930
And then if it's checked, it's zero now.

24
00:01:20,130 --> 00:01:21,780
And then if it's checked, it's one.

25
00:01:22,020 --> 00:01:23,790
If it's unchecked, it's zero.

26
00:01:24,100 --> 00:01:25,380
OK, so that's fine.

27
00:01:25,380 --> 00:01:28,850
But oftentimes you'll times you'll have lots of checkboxes.

28
00:01:29,100 --> 00:01:34,200
So if they're all zeros and ones, that it's hard to keep track of these things.

29
00:01:34,210 --> 00:01:39,060
So what you really want to do is assign a value to whether it's checked or unchecked.

30
00:01:39,180 --> 00:01:45,180
And for the check button widget, that value is called an non-value or an off value.

31
00:01:45,190 --> 00:01:47,910
So if you check it, it's on value.

32
00:01:51,210 --> 00:01:57,210
And then if it if you uncheck it, it's an off value.

33
00:01:58,420 --> 00:02:02,290
And we just did sign what this is so unvaluable called peperoni.

34
00:02:03,460 --> 00:02:06,070
And capital or lower case, it really doesn't matter.

35
00:02:06,100 --> 00:02:11,620
So off value, I'll just call, know, underscore peperoni.

36
00:02:12,910 --> 00:02:17,980
So if we're creating a pizza app for pizza delivery, if you want to order pizza, do you want pepperoni

37
00:02:17,980 --> 00:02:18,850
or no pepperoni?

38
00:02:19,480 --> 00:02:20,770
So that's the non-value.

39
00:02:21,850 --> 00:02:29,530
And now we can just my underscore check that hack this guy onto the screen and let's save this and run

40
00:02:29,530 --> 00:02:29,640
it.

41
00:02:30,370 --> 00:02:32,080
So we're checkboxes up by.

42
00:02:33,570 --> 00:02:39,360
And you see, it's already checked for us, and that's probably not what you want.

43
00:02:39,390 --> 00:02:41,750
You usually want these unchecked by default.

44
00:02:42,090 --> 00:02:44,640
So let's go ahead and show you how to do that real quick.

45
00:02:44,640 --> 00:02:52,500
And what we can do is just call my underscore check dot d select and that's a function.

46
00:02:52,800 --> 00:02:56,940
So now if we save this and run it, we see it's not checked by default.

47
00:02:56,940 --> 00:02:58,410
If we click it, we're good to go.

48
00:02:58,650 --> 00:03:01,660
OK, so again now how do we do something with this.

49
00:03:01,680 --> 00:03:02,700
Well let's create a button.

50
00:03:04,200 --> 00:03:11,520
And it's called my underscore button, and this is a button and it's in route, and we want the text

51
00:03:11,520 --> 00:03:16,230
to say order or select.

52
00:03:20,040 --> 00:03:25,140
And then we want the command to be toppings, pizza toppings, whatever.

53
00:03:26,640 --> 00:03:31,560
Analysts pack this guy on the screen and let's give it a pad Y of.

54
00:03:32,460 --> 00:03:38,790
Ten, just to give it some space, and then here up at the top, we can create.

55
00:03:40,070 --> 00:03:42,050
Toppings function.

56
00:03:42,620 --> 00:03:46,990
So we want to define toppings and what do you want to do?

57
00:03:47,000 --> 00:03:49,610
Let's create a label just to see what this is.

58
00:03:51,180 --> 00:03:57,870
So that's equal to label and it's and root, this should be old hat by now we want the text to equal

59
00:03:57,870 --> 00:04:01,890
V get like we did in the last video.

60
00:04:01,920 --> 00:04:06,060
I want to get this string vare, which is, again, that special Kintner variable.

61
00:04:06,990 --> 00:04:08,640
And what else?

62
00:04:08,940 --> 00:04:09,910
That's probably it.

63
00:04:09,990 --> 00:04:10,260
Right.

64
00:04:10,290 --> 00:04:12,900
So my underscore labeled dot hack.

65
00:04:13,470 --> 00:04:16,170
And let's give this iPad a high of ten just for fun.

66
00:04:17,220 --> 00:04:20,930
OK, so that should do the trick, let's save this and run it.

67
00:04:21,950 --> 00:04:27,490
We have peperoni, select shopping, boom peperoni, and you'll notice it's lower case.

68
00:04:27,740 --> 00:04:29,210
That's because.

69
00:04:30,290 --> 00:04:39,020
Here are on value is peperoni lowercase case, so if we run this again and see what happens if we don't

70
00:04:39,020 --> 00:04:41,150
check it, it's like toppings.

71
00:04:41,150 --> 00:04:42,620
No pepperoni, right?

72
00:04:42,950 --> 00:04:44,540
Like daubing pepperoni.

73
00:04:45,320 --> 00:04:46,790
No, no pepperoni.

74
00:04:47,630 --> 00:04:48,080
Very cool.

75
00:04:48,200 --> 00:04:54,650
And again, just like in the last video, if we want to do something with this, we can now we can go

76
00:04:54,890 --> 00:04:57,260
if we get.

77
00:04:59,580 --> 00:05:00,600
Equals.

78
00:05:02,550 --> 00:05:03,510
Peperoni.

79
00:05:04,650 --> 00:05:14,730
Then my label equals, I don't know, you ordered pepperoni.

80
00:05:17,610 --> 00:05:18,340
Else.

81
00:05:22,730 --> 00:05:31,280
You don't want pepperoni and we can just get rid of that and we still want to pack the whole thing onto

82
00:05:31,280 --> 00:05:31,580
the screen.

83
00:05:31,610 --> 00:05:34,160
OK, so let's run this and see if that did the trick.

84
00:05:34,610 --> 00:05:39,050
Oh, I got to close area.

85
00:05:39,500 --> 00:05:40,310
Close our.

86
00:05:43,670 --> 00:05:44,930
OK, so this'll work now.

87
00:05:45,560 --> 00:05:47,050
Come back here, run again.

88
00:05:48,380 --> 00:05:53,630
So if we click peperoni, you order pepperoni, if we uncheck it, you don't want pepperoni and that's

89
00:05:53,630 --> 00:05:54,200
how that works.

90
00:05:54,380 --> 00:05:56,770
Now you can have as many.

91
00:05:56,770 --> 00:06:01,790
We just created one for the sake of example, but you can create as many of these checkboxes as you

92
00:06:01,790 --> 00:06:06,920
want just by creating another variable called my check to my check three, my check for, et cetera,

93
00:06:07,670 --> 00:06:09,020
and then running through there.

94
00:06:09,440 --> 00:06:15,020
And I want to create different string variables to correspond to each one probably.

95
00:06:15,350 --> 00:06:21,140
Or if you want to get fancy, you could probably find a way to append these to a python list sort of

96
00:06:21,140 --> 00:06:22,250
beyond the scope of this.

97
00:06:22,250 --> 00:06:26,090
But you can figure it out if you're good at Python on your own.

98
00:06:26,270 --> 00:06:32,090
Otherwise you would just, you know, maybe change this to my underscore check.

99
00:06:35,560 --> 00:06:36,940
Vare one.

100
00:06:37,870 --> 00:06:42,790
Or my check vare my check one and then maybe change this to my check one, and then if you created a

101
00:06:42,790 --> 00:06:46,120
second one, you would call it my check to vare my check, three, four, etc..

102
00:06:46,600 --> 00:06:48,850
I'll just leave it back the way it was, though.

103
00:06:50,780 --> 00:06:52,050
All right, but you get the idea.

104
00:06:52,340 --> 00:06:56,990
So those are checkboxes pretty simple in the next video, we're going to look at pop up boxes.
