0
1
00:00:04,820 --> 00:00:06,700
<v Narrator>Hello,everybody in this lecture  we are going to learn</v>
1

2
00:00:06,700 --> 00:00:10,400
how we can use radio buttons for our applications.
2

3
00:00:10,400 --> 00:00:12,249
To do that, what we need to do here
3

4
00:00:12,249 --> 00:00:15,380
I will use our existing project okay,
4

5
00:00:15,380 --> 00:00:17,620
I will use our existing project
5

6
00:00:17,620 --> 00:00:18,453
and here what we need to do,
6

7
00:00:18,453 --> 00:00:20,790
we need to create like before
7

8
00:00:20,790 --> 00:00:22,931
variable for our radio button, okay
8

9
00:00:22,931 --> 00:00:26,900
and after that we need to create our radio buttons,
9

10
00:00:26,900 --> 00:00:28,172
but before what we need to do,
10

11
00:00:28,172 --> 00:00:30,740
as I said we need to create our variable.
11

12
00:00:30,740 --> 00:00:33,340
That's why I will create here a variable and
12

13
00:00:33,340 --> 00:00:34,815
it's name will be gender okay,
13

14
00:00:34,815 --> 00:00:37,843
and this variable will be string variable because
14

15
00:00:37,843 --> 00:00:40,040
why string variable?
15

16
00:00:40,040 --> 00:00:45,010
As you remember before for check button we used zero and one
16

17
00:00:45,010 --> 00:00:47,000
and it was integer variable right,
17

18
00:00:47,000 --> 00:00:49,660
but now we will use genders okay,
18

19
00:00:49,660 --> 00:00:50,610
male or female.
19

20
00:00:50,610 --> 00:00:53,270
That's why we will use string variables, okay,
20

21
00:00:53,270 --> 00:00:54,380
for our radio button,
21

22
00:00:54,380 --> 00:00:56,033
and after here what I need to do,
22

23
00:00:57,384 --> 00:00:59,280
and now I created my variable,
23

24
00:00:59,280 --> 00:01:01,470
and now I can create my radio buttons,
24

25
00:01:01,470 --> 00:01:05,380
here I will say ttk.Radiobutton okay,
25

26
00:01:05,380 --> 00:01:07,440
and the first parameter will be root,
26

27
00:01:07,440 --> 00:01:09,910
I will pass in root and after that what I need to do,
27

28
00:01:09,910 --> 00:01:11,180
I need to create a text for
28

29
00:01:12,454 --> 00:01:13,920
my radio button right,
29

30
00:01:13,920 --> 00:01:17,220
so for text I will say male okay,
30

31
00:01:17,220 --> 00:01:21,360
and after that my third parameter will be my value okay,
31

32
00:01:21,360 --> 00:01:26,360
value is equal to lets say again male okay, for my value
32

33
00:01:26,550 --> 00:01:30,552
and the last parameter will be our variable okay,
33

34
00:01:30,552 --> 00:01:32,845
we can say variable
34

35
00:01:32,845 --> 00:01:33,678
like that,
35

36
00:01:33,678 --> 00:01:36,187
or short one you can say var okay,
36

37
00:01:36,187 --> 00:01:38,670
for var we need to say gender okay,
37

38
00:01:38,670 --> 00:01:39,560
we already created it.
38

39
00:01:39,560 --> 00:01:43,110
Now what I need to do, I need to use grid geometry manager,
39

40
00:01:43,110 --> 00:01:47,793
and here I will say grid and the row will be five,
40

41
00:01:49,490 --> 00:01:52,900
and the column will be zero okay,
41

42
00:01:52,900 --> 00:01:56,750
and now if I run my application.
42

43
00:01:56,750 --> 00:01:57,693
It is ready.
43

44
00:01:59,930 --> 00:02:04,120
It's here, as you see now male is here, okay.
44

45
00:02:04,120 --> 00:02:05,760
Also I want to create another one,
45

46
00:02:05,760 --> 00:02:07,319
and it will be female okay,
46

47
00:02:07,319 --> 00:02:09,403
and I will locate it here,
47

48
00:02:10,480 --> 00:02:14,531
I will locate it at column two okay,
48

49
00:02:14,531 --> 00:02:17,670
that's why what I need to do here I will come here,
49

50
00:02:17,670 --> 00:02:22,140
radio button here and I will press control D okay,
50

51
00:02:22,140 --> 00:02:25,400
now for that one what I need to do I need to say female
51

52
00:02:25,400 --> 00:02:28,270
value will be female and variable is gender
52

53
00:02:28,270 --> 00:02:32,640
and the row is five, column will be only one okay,
53

54
00:02:32,640 --> 00:02:35,223
and if I run it again, lets run it.
54

55
00:02:39,190 --> 00:02:44,000
See it's here, our male and female is also here,
55

56
00:02:44,000 --> 00:02:45,287
what I need to do now,
56

57
00:02:45,287 --> 00:02:47,940
I need to show you how we can get this value
57

58
00:02:47,940 --> 00:02:49,950
from our radio button okay.
58

59
00:02:49,950 --> 00:02:51,300
To do that what we need to do,
59

60
00:02:51,300 --> 00:02:54,490
we need to come here and here as you remember
60

61
00:02:54,490 --> 00:02:56,140
we already create our callback function
61

62
00:02:56,140 --> 00:02:58,313
and here I will say print.
62

63
00:03:00,390 --> 00:03:03,280
My variable name is gender right
63

64
00:03:03,280 --> 00:03:07,370
and I will say gender.get method okay.
64

65
00:03:07,370 --> 00:03:11,900
If I use that one and I can get the value of my radio button
65

66
00:03:11,900 --> 00:03:14,103
okay, now if I run my application again,
66

67
00:03:15,210 --> 00:03:16,263
and it's here.
67

68
00:03:17,730 --> 00:03:19,223
Now, if I.
68

69
00:03:20,500 --> 00:03:23,060
Okay lets choose that one, male one
69

70
00:03:23,060 --> 00:03:26,050
and now focus over here okay our console,
70

71
00:03:26,050 --> 00:03:29,370
and if I press enter and lets also say remember me
71

72
00:03:30,270 --> 00:03:33,580
now you see your name is, please enter your name
72

73
00:03:33,580 --> 00:03:35,100
because we didn't fill this guy,
73

74
00:03:35,100 --> 00:03:37,820
and also that one, the password is that one,
74

75
00:03:37,820 --> 00:03:39,750
remember me selected right
75

76
00:03:39,750 --> 00:03:43,430
and our radio button value is male,
76

77
00:03:43,430 --> 00:03:45,951
if I choose female and again enter,
77

78
00:03:45,951 --> 00:03:50,354
as you see now our value for radio button is female.
78

79
00:03:50,354 --> 00:03:53,730
This is how we can use radio buttons for our applications.
79

80
00:03:53,730 --> 00:03:55,730
For now that's all, see you in the next.
