0
1
00:00:05,070 --> 00:00:06,470
<v Narrator>In this lecture we are going to learn</v>
1

2
00:00:06,470 --> 00:00:09,170
how we can create a progress bar for our applications.
2

3
00:00:09,170 --> 00:00:12,400
To that we need to do. I will create here a variable,
3

4
00:00:12,400 --> 00:00:16,340
and I will name it, progress bar a short name, okay?
4

5
00:00:16,340 --> 00:00:19,170
And, here what we need to do is use ttk module okay?
5

6
00:00:19,170 --> 00:00:22,316
Ttk dot progress bar. Okay?
6

7
00:00:22,316 --> 00:00:25,450
And our first parameter, of course it will be root,
7

8
00:00:25,450 --> 00:00:30,450
our top level widget, top level window,
8

9
00:00:30,570 --> 00:00:32,240
and after that our 
9

10
00:00:32,240 --> 00:00:35,220
second parameter will be orient okay?
10

11
00:00:35,220 --> 00:00:37,560
And for orient, we have two choices.
11

12
00:00:37,560 --> 00:00:40,240
The first one is vertical, the second one is horizontal.
12

13
00:00:40,240 --> 00:00:43,100
So, I will choose, horizontal one.
13

14
00:00:43,100 --> 00:00:45,550
And after that here, by default,
14

15
00:00:45,550 --> 00:00:47,640
actually let's use pack geometry manager,
15

16
00:00:47,640 --> 00:00:49,050
then after that I will show you something.
16

17
00:00:49,050 --> 00:00:53,473
Let's say pack, and here if I run my application,
17

18
00:00:54,960 --> 00:00:57,097
as you see now our progress bar is here,
18

19
00:00:57,097 --> 00:00:58,370
but its quite small.
19

20
00:00:58,370 --> 00:01:02,783
So, you need to use length, for our application,
20

21
00:01:03,760 --> 00:01:07,840
I say length is equal to 200, okay?
21

22
00:01:07,840 --> 00:01:12,840
And, also let's add some pad for our y value,
22

23
00:01:13,390 --> 00:01:16,850
pad y is equal to 20.
23

24
00:01:16,850 --> 00:01:19,190
If I run my application now, as you see now
24

25
00:01:19,190 --> 00:01:21,170
its more reasonable, our pad is here,
25

26
00:01:21,170 --> 00:01:24,160
and our progress bar is bigger.
26

27
00:01:24,160 --> 00:01:27,750
So, what is next, what we can do for our progress bar?
27

28
00:01:27,750 --> 00:01:30,520
For progress bar, we have two modes, okay?
28

29
00:01:30,520 --> 00:01:32,810
For the first one indeterminate and
29

30
00:01:32,810 --> 00:01:34,480
second one is determinate.
30

31
00:01:34,480 --> 00:01:38,640
Let me show you the first mode for our progress bar.
31

32
00:01:38,640 --> 00:01:41,910
I say progress bar dot config method
32

33
00:01:41,910 --> 00:01:46,910
and here I will say mode is equal to indeterminate. Okay?
33

34
00:01:50,260 --> 00:01:52,930
And after here I want to start my progress bar.
34

35
00:01:52,930 --> 00:01:55,680
Progress bar dot start, okay?
35

36
00:01:55,680 --> 00:01:57,483
If I run my application,
36

37
00:01:59,080 --> 00:02:01,490
as you see now, this is our indeterminate mode
37

38
00:02:01,490 --> 00:02:04,310
and our progress bar is working now.
38

39
00:02:04,310 --> 00:02:06,990
And lets stop it and also see how
39

40
00:02:06,990 --> 00:02:08,870
we can use determinate mode.
40

41
00:02:08,870 --> 00:02:11,443
Here I will say progress bar dot stop.
41

42
00:02:13,350 --> 00:02:16,900
Okay, and after here I will say again progress bar dot
42

43
00:02:16,900 --> 00:02:21,543
config, for mode, I will say determinate.
43

44
00:02:23,101 --> 00:02:24,018
determinate
44

45
00:02:25,810 --> 00:02:27,840
Now lets see also our determinate mode,
45

46
00:02:27,840 --> 00:02:31,080
but before that, what we need to do to use here
46

47
00:02:31,080 --> 00:02:34,513
start, right? Progress bar start.
47

48
00:02:37,372 --> 00:02:39,033
If I run my application now,
48

49
00:02:40,340 --> 00:02:42,730
as you see now this is our determinate mode
49

50
00:02:42,730 --> 00:02:44,350
and how it is looking.
50

51
00:02:44,350 --> 00:02:47,200
And I want to show you something here now,
51

52
00:02:47,200 --> 00:02:52,130
we can use for our progress bar maximum and also,
52

53
00:02:52,130 --> 00:02:56,930
value properties. Maximum value lets say maximum
53

54
00:03:02,263 --> 00:03:05,430
maximum is equal to, you can say, for example
54

55
00:03:05,430 --> 00:03:09,550
50, but you should use here double variables, okay?
55

56
00:03:09,550 --> 00:03:14,550
and 50 point zero, okay? And, also we can
56

57
00:03:14,780 --> 00:03:17,640
define value for our progress bar.
57

58
00:03:17,640 --> 00:03:22,600
For example, if I say, okay maximum is 50 but my value
58

59
00:03:22,600 --> 00:03:26,250
is 10. Okay? And 10 point zero.
59

60
00:03:26,250 --> 00:03:29,300
If I start my progress bar now, as you see know,
60

61
00:03:29,300 --> 00:03:33,210
it's faster because its value, each time its value
61

62
00:03:33,210 --> 00:03:36,400
is increased 10 percent. Okay, not percent actually,
62

63
00:03:36,400 --> 00:03:40,787
it is 10 times, like 50 like the value,
63

64
00:03:40,787 --> 00:03:45,787
and each time, our progress bar is increase its value 10.
64

65
00:03:46,370 --> 00:03:50,140
Okay? And by 10. So, what is next also,
65

66
00:03:50,140 --> 00:03:52,140
I want to show you something here,
66

67
00:03:52,140 --> 00:03:57,140
now I want to also create a here a scale. A scale widget.
67

68
00:03:58,570 --> 00:04:03,130
And when I scale up and down, I want to change
68

69
00:04:03,130 --> 00:04:05,610
our progress bar value, Okay?
69

70
00:04:05,610 --> 00:04:06,780
To that what I need to do here,
70

71
00:04:06,780 --> 00:04:09,540
I will firstly progress bar dot stop.
71

72
00:04:09,540 --> 00:04:11,020
Okay, I will stop it.
72

73
00:04:11,020 --> 00:04:13,280
And after that here I need to create a value
73

74
00:04:14,880 --> 00:04:17,990
or let's create our scale and after that we can create
74

75
00:04:17,990 --> 00:04:21,330
a value for our progress bar.
75

76
00:04:21,330 --> 00:04:24,870
Scale is equal to ttk dot scale,
76

77
00:04:24,870 --> 00:04:27,860
okay use ttk module here, again.
77

78
00:04:27,860 --> 00:04:31,240
And first parameter is,  root
78

79
00:04:31,240 --> 00:04:34,650
and second one is orient is equal to, I will say
79

80
00:04:34,650 --> 00:04:39,650
again horizontal, and now also lets use length,
80

81
00:04:41,770 --> 00:04:45,500
is equal to 200 okay?
81

82
00:04:45,500 --> 00:04:48,640
And here if I run my application, but before that
82

83
00:04:48,640 --> 00:04:51,510
we need to use pack geometry manager, pack okay?
83

84
00:04:51,510 --> 00:04:54,003
Now if I run my application,
84

85
00:04:55,870 --> 00:04:58,570
as you see now our scale is also here,
85

86
00:04:58,570 --> 00:05:03,570
and I up and down, now I want to change progress bar
86

87
00:05:04,130 --> 00:05:06,670
value by doing this, we stopped our progress bar,
87

88
00:05:06,670 --> 00:05:10,380
that's why it does nothing here, okay?
88

89
00:05:10,380 --> 00:05:14,510
So, when I up and down my scale, how I can change
89

90
00:05:14,510 --> 00:05:15,710
my progress bar value.
90

91
00:05:15,710 --> 00:05:17,963
To do that, what I need to do here,
91

92
00:05:17,963 --> 00:05:20,670
I need to create a variable here, okay?
92

93
00:05:20,670 --> 00:05:23,800
Sorry, a value here, value is equal to, I need to say
93

94
00:05:23,800 --> 00:05:25,320
double var. Why is it double?
94

95
00:05:25,320 --> 00:05:29,270
Because, our maximum value is double, okay?
95

96
00:05:29,270 --> 00:05:31,780
That's why you use double variable here.
96

97
00:05:31,780 --> 00:05:34,920
And, here what I need to do I need to say,
97

98
00:05:34,920 --> 00:05:39,037
value, sorry its variable let's use firstly
98

99
00:05:39,037 --> 00:05:42,140
Variable, you can say or var short one, okay?
99

100
00:05:42,140 --> 00:05:46,220
Var is equal to value and after here I need to say
100

101
00:05:46,220 --> 00:05:51,220
from, but from this special key, keyword in Python, like
101

102
00:05:51,300 --> 00:05:54,340
here, okay, that's why we need to say, from underscore,
102

103
00:05:54,340 --> 00:05:59,240
is equal to from zero point zero, and to
103

104
00:06:00,440 --> 00:06:04,720
my maximum value it was 50, right? 50 point zero.
104

105
00:06:04,720 --> 00:06:09,720
Okay? And now, what I need to do also, I think its fine.
105

106
00:06:10,490 --> 00:06:13,930
its finish now, when we change our value okay,
106

107
00:06:13,930 --> 00:06:17,160
we will also, when we make up and down,
107

108
00:06:17,160 --> 00:06:21,840
we will change our, also,... progress bar value. Okay?
108

109
00:06:24,550 --> 00:06:26,403
Now if I run my application,
109

110
00:06:29,590 --> 00:06:34,230
run, now,... something wrong here.
110

111
00:06:34,230 --> 00:06:36,050
Sorry, so what I need to do here...
111

112
00:06:38,800 --> 00:06:42,410
and the value is, okay its, here...
112

113
00:06:42,410 --> 00:06:45,280
Its okay, and something...
113

114
00:06:46,400 --> 00:06:47,950
To do something more...
114

115
00:06:48,980 --> 00:06:51,480
Progress bar dot here, we need to say,
115

116
00:06:51,480 --> 00:06:55,987
progress bar, so we need to define this value
116

117
00:06:55,987 --> 00:06:57,990
for our progress bar, right?
117

118
00:06:57,990 --> 00:07:02,990
So, for progress bar dot config and here I will say
118

119
00:07:04,085 --> 00:07:08,960
variable, for my progress bar is also, value, okay?
119

120
00:07:08,960 --> 00:07:12,637
And now, it will work, its value here, so,
120

121
00:07:12,637 --> 00:07:17,460
I'm to cut this guy and paste it here. Okay?
121

122
00:07:17,460 --> 00:07:19,910
Now it... it will work.
122

123
00:07:19,910 --> 00:07:21,913
Now if I run my application again,
123

124
00:07:22,860 --> 00:07:25,880
and now check it, up and down you see,
124

125
00:07:25,880 --> 00:07:30,880
when I up and down I also change my progress bar value.
125

126
00:07:31,030 --> 00:07:33,980
This is how we can use scale and also progress bar
126

127
00:07:33,980 --> 00:07:36,483
widgets. For now that's all. See you in the next.
