1
00:00:05,380 --> 00:00:09,190
ok so continue on in looking at our interface this is what we trying to build at the

2
00:00:09,190 --> 00:00:10,120
moment

3
00:00:10,120 --> 00:00:15,410
so far we got the basics of that program
coming up we've actually got some of the

4
00:00:15,410 --> 00:00:22,710
contents on the screen and we are gonna have a look
at what we've done there so you can see we're making

5
00:00:22,710 --> 00:00:26,560
progress but we still haven't bit of a way
to go we got these other fields that we

6
00:00:26,560 --> 00:00:32,670
want to add to add to the interface and
on these buttons and we got an issue here

7
00:00:32,670 --> 00:00:35,830
in down the left hand side you can see at the moment down here that's not working

8
00:00:35,830 --> 00:00:40,860
so we got a couple of work to do ahead so
let's continue that so it looks like it's

9
00:00:40,860 --> 00:00:44,880
rather strange program is going to display the
file name part of the time stamp of whatever

10
00:00:44,880 --> 00:00:49,470
file selected in the list box what we now need to
do is add an entry widget to show that

11
00:00:49,470 --> 00:00:52,950
result now the widgets is going to be labeled to
make it obvious that this is the result

12
00:00:52,950 --> 00:00:59,130
and both the entry widget and the label are placed
in the same cell of the grid now I'm going to use the

13
00:00:59,130 --> 00:01:02,540
sticky property make sure that its set so that
they appear in the bottom left and top

14
00:01:02,540 --> 00:01:06,950
left of the cell so as long as the row is high enough for both of them to fit things should

15
00:01:06,950 --> 00:01:11,520
look ok if you resize the
application the actual windows the labels is going

16
00:01:11,520 --> 00:01:15,490
to disappear behind the entry widget as the window gets
to small and indeed you can prevent that

17
00:01:15,490 --> 00:01:19,640
behavior to some extent by placing the 2 widgets on separate rows which we

18
00:01:19,640 --> 00:01:23,240
maybe should have done but we're not
going to do here now but we didn't

19
00:01:23,240 --> 00:01:26,390
because we want to demonstrate this
behavior so no matter what you do though

20
00:01:26,390 --> 00:01:30,440
if a user makes the application window too
small for all the widgets to fit and they are going to get

21
00:01:30,440 --> 00:01:34,070
odd results you can't really do anything
about that really but we'll have a look

22
00:01:34,070 --> 00:01:37,450
at how we can prevent the window from being
resize too small a little bit later

23
00:01:37,450 --> 00:01:48,130
on so for now let's continue and what I'm going to do is add that entry I talk about so.....

24
00:01:48,130 --> 00:01:55,700
......

25
00:01:55,700 --> 00:02:03,840
.......

26
00:02:03,840 --> 00:02:27,230
......

27
00:02:27,230 --> 00:02:37,310
so if we run this now we should be able to see that you can see we got our little result their we got the label and the actual field the

28
00:02:37,310 --> 00:02:41,870
entry that its going to actually contain the
data so let's now add the frame for the

29
00:02:41,870 --> 00:02:47,500
time spinner so make a bit of space here we will add the extra line so we can

30
00:02:47,500 --> 00:03:10,400
see what we are doing and lets add a comment here as well.....so we know what's that for and un-comment that alright lets continue on, line 57 is going to be....

31
00:03:10,400 --> 00:03:25,990
......

32
00:03:25,990 --> 00:03:44,490
.......

33
00:03:44,490 --> 00:03:49,480
....ok now the time spinner since we added the frame now its the actual spinners themselves so start

34
00:03:49,480 --> 00:03:53,350
with the hour......

35
00:03:53,350 --> 00:04:04,700
......

36
00:04:04,700 --> 00:04:10,280
...which is a pretty
cool way of defining a range of

37
00:04:10,280 --> 00:04:15,200
values that are applicable for an hour for 24
hour clock of course the values is going to be 0

38
00:04:15,200 --> 00:04:26,260
to 23 effectively.....actually what I'll do is copy those....

39
00:04:26,260 --> 00:04:38,630
....minute spinner we are gonna set that to the same width and same frame but instead of using values we are going

40
00:04:38,630 --> 00:04:41,680
to use another way from and to just to
show you how to do that so

41
00:04:41,680 --> 00:04:53,320
change this here and put from.....

42
00:04:53,320 --> 00:04:59,030
...same for this one.....

43
00:04:59,030 --> 00:05:06,720
.....now obviously in the case of the first
one on line 61 the values is going to be 0 to

44
00:05:06,720 --> 00:05:10,910
23 but if you use from and 2 the advantage is that you don't have to

45
00:05:10,910 --> 00:05:14,950
remember to add one to the final value as you
do with using range so keep that in mind

46
00:05:14,950 --> 00:05:21,250
as well and the reason case you're wondering
why the underscore and that's because

47
00:05:21,250 --> 00:05:25,480
from is a reserved word in Python and the
option has a underscored in the end from

48
00:05:25,480 --> 00:05:37,600
underscore because of that to get around that restriction that reserved word
and this one is going to be........ok so lets add them first the hour

49
00:05:37,600 --> 00:05:48,080
spinners so......

50
00:05:48,080 --> 00:06:10,860
......

51
00:06:10,860 --> 00:06:19,440
......and we're just gonna do exactly
the same with the actual label and

52
00:06:19,440 --> 00:06:24,500
actually we don't need the label at the end because it is going to be a column between the
hour and minute and the minute and the

53
00:06:24,500 --> 00:06:28,420
second there is not a column at the end that is added after the second and this one here is

54
00:06:28,420 --> 00:06:35,760
going to second spinner......

55
00:06:35,760 --> 00:06:42,040
......and looking at columns the hour spinners is on column 0 the columns on

56
00:06:42,040 --> 00:06:46,600
column 1 the minute is on column 2 then another on column 3 and of course

57
00:06:46,600 --> 00:06:58,930
on column 4 is our second spinner ok so then we just need on line 70 the main loop and we just leave the print their for now.....

58
00:06:58,930 --> 00:07:04,390
and again the columns I am adding are purely for cosmetic
reasons there's no actual points assigning the

59
00:07:04,390 --> 00:07:11,160
labels to variables and that is why I have added it the way I have because we are not storing results for the columns but don't worry

60
00:07:11,160 --> 00:07:14,570
too much of that doesn't make sense in
terms of methods because we are going to be covering

61
00:07:14,570 --> 00:07:18,620
functions next and classes in the next
section after that and it will all become

62
00:07:18,620 --> 00:07:28,700
abundantly clear so if we run this and you can
see obviously that's meant to be down

63
00:07:28,700 --> 00:07:31,720
here and that's obviously

64
00:07:31,720 --> 00:07:38,230
row 0 and this is occupying 2 rows one and
two remember we hada row span of 2 their so

65
00:07:38,230 --> 00:07:41,950
consequently the row should be 3
and obviously for the grid what I did

66
00:07:41,950 --> 00:07:54,200
was I added it accidentally to row 0 so set it to row 3 and close it down run again you can see its

67
00:07:54,200 --> 00:07:58,610
a little bit better its in the right position but still a
bit messy and its really too close

68
00:07:58,610 --> 00:08:02,540
to the left hand side as well so the
good thing is that widgets have an option to

69
00:08:02,540 --> 00:08:07,020
set padding for their contents using
padx and pady and that's sort of pads it

70
00:08:07,020 --> 00:08:11,420
over or adds a bit of padding between the left
and on the right hand side so what we gonna

71
00:08:11,420 --> 00:08:14,610
do is we want to introduced some padding
inside the label frame widget that

72
00:08:14,610 --> 00:08:20,880
contains our spinner so we are going to come back
and do that....

73
00:08:20,880 --> 00:08:27,220
...and lets go and add....

74
00:08:27,220 --> 00:08:34,890
.......and that puts padding inside the
left and right edges of the widget and

75
00:08:34,890 --> 00:08:38,850
pady would be used to pad the top and
the bottom but we don't need to do that here so by

76
00:08:38,850 --> 00:08:46,200
doing if we run again you can see
now that the actual contents of

77
00:08:46,200 --> 00:08:51,140
that frame has now been centered and move
move much over we got some padding now on the left

78
00:08:51,140 --> 00:08:55,390
and right hand side so that's nicer and we'll
have a look at this left padding a bit

79
00:08:55,390 --> 00:09:00,810
later on so let's continue on close it
down so spinners can be a useful way to allow

80
00:09:00,810 --> 00:09:05,080
user to enter value and a range and actually lets run that againg to

81
00:09:05,080 --> 00:09:10,610
to confirm that it acutally did the right thing so if we have
a look at the code we should see

82
00:09:10,610 --> 00:09:17,310
the valid ranges I'm pressing the up there you can see here that 23 is the maximum

83
00:09:17,310 --> 00:09:22,990
value because we specify the range of 0 to 24
you can see that 23 is the maximum like wise we should be

84
00:09:22,990 --> 00:09:29,060
able to go up and take me a bit of clicking but we should be able to get it to 59

85
00:09:29,060 --> 00:09:34,260
for the minutes and the seconds I won't do the second but
confirm that the minutes

86
00:09:34,260 --> 00:09:40,330
actually works you can see that's working so it
can be very useful the spinners to allow

87
00:09:40,330 --> 00:09:44,270
users to enter a value and a range and there's
two ways to specify the range as I

88
00:09:44,270 --> 00:09:47,470
mentioned back in the code
you can actually use the from or

89
00:09:47,470 --> 00:09:52,160
you can actually use the value like so using a tuple with a values options probably of more use when you

90
00:09:52,160 --> 00:09:56,080
can't just set the start and end values
so that's a good candidate for the months

91
00:09:56,080 --> 00:10:01,840
for example but will do that shortly so let's go back
and actually do that

92
00:10:01,840 --> 00:10:17,020
now so we're going........

93
00:10:17,020 --> 00:11:36,880
......

94
00:11:36,880 --> 00:11:47,620
.......

95
00:11:47,620 --> 00:11:59,950
........

96
00:11:59,950 --> 00:12:06,860
.......

97
00:12:06,860 --> 00:12:08,280
......

98
00:12:08,280 --> 00:12:17,220
...because we git months we got to show on the screen.....

99
00:12:17,220 --> 00:12:26,850
...we are going to specify some values like so......not using
a tuple like we did on in line 61 for the house we are gonna do....

100
00:12:26,850 --> 00:12:31,670
....and just put a different values we want to populate....and this
makes more sense

101
00:12:31,670 --> 00:12:51,180
when we got text like such as the months to try and
do it any other way......

102
00:12:51,180 --> 00:13:34,410
......

103
00:13:34,410 --> 00:13:49,540
.....so that should that be that so let us run that and see what

104
00:13:49,540 --> 00:14:00,960
that looks like you can see we got our date month and
year showing their and if we just tab over and look at what we are

105
00:14:00,960 --> 00:14:06,380
trying achieve originally we chose a different
type of frame obviously we didn't use

106
00:14:06,380 --> 00:14:12,040
the label frame like we use for time but you can see that
the pop ups are their and the values and we can

107
00:14:12,040 --> 00:14:17,220
see that there's a list we can choose a
different values there and I won't go through them

108
00:14:17,220 --> 00:14:23,190
all but obviously you can see it's starting on year 2000 and will go up to 2099 that's good

109
00:14:23,190 --> 00:14:27,500
that's working so I'm going to finish this
video here we are just about done in the next

110
00:14:27,500 --> 00:14:30,790
video what we're going to do is
finish the layout with the ok and cancel

111
00:14:30,790 --> 00:14:33,720
buttons but then we are going to add a
little bit of functionality to some of

112
00:14:33,720 --> 00:14:37,850
the buttons to do certain things like
close the application off properly by introducing

113
00:14:37,850 --> 00:14:41,540
a quit method and a few other bits and
pieces so we'll look at doing that the

114
00:14:41,540 --> 00:14:41,910
in the next video

