0
1
00:00:04,544 --> 00:00:05,639
<v Instructor>Hello again.</v>
1

2
00:00:05,639 --> 00:00:07,533
In this lecture what we are going to do
2

3
00:00:07,533 --> 00:00:09,257
let me explain it.
3

4
00:00:09,257 --> 00:00:13,180
Firstly, I want to run my application.
4

5
00:00:13,180 --> 00:00:15,007
And our application is here, right?
5

6
00:00:15,007 --> 00:00:18,007
And when I click My People you see is here,
6

7
00:00:18,007 --> 00:00:19,234
another page okay,
7

8
00:00:19,234 --> 00:00:20,839
here open again new page.
8

9
00:00:20,839 --> 00:00:23,179
At My People page, right?
9

10
00:00:23,179 --> 00:00:26,761
And this is our main window, we want to keep this one.
10

11
00:00:26,761 --> 00:00:28,848
But when I click add,
11

12
00:00:28,848 --> 00:00:30,557
as you see now I here,
12

13
00:00:30,557 --> 00:00:33,147
I open a new page, but still this page,
13

14
00:00:33,147 --> 00:00:34,531
this window is,
14

15
00:00:34,531 --> 00:00:35,586
it's still here.
15

16
00:00:35,586 --> 00:00:38,581
So what I need to do, what I want to do
16

17
00:00:38,581 --> 00:00:40,510
I want to destroy this window
17

18
00:00:40,510 --> 00:00:43,099
and only I want to keep my main window
18

19
00:00:43,099 --> 00:00:45,016
and also which button,
19

20
00:00:45,016 --> 00:00:48,099
which window I click okay, I pressed.
20

21
00:00:49,014 --> 00:00:52,499
So how can I solve this problem?
21

22
00:00:52,499 --> 00:00:54,834
To do that I need to come My People here
22

23
00:00:54,834 --> 00:00:57,904
and then I create my instance.
23

24
00:00:57,904 --> 00:01:00,237
After that I want to destroy
24

25
00:01:01,484 --> 00:01:03,080
previous window.
25

26
00:01:03,080 --> 00:01:04,584
So self dot destroy
26

27
00:01:04,584 --> 00:01:06,098
Simply I will say, okay?
27

28
00:01:06,098 --> 00:01:07,665
Now if I run my application.
28

29
00:01:07,665 --> 00:01:08,498
Now, run.
29

30
00:01:09,907 --> 00:01:11,104
This our main window, alright.
30

31
00:01:11,104 --> 00:01:12,042
It's okay, it's here.
31

32
00:01:12,042 --> 00:01:13,862
So, my person is here.
32

33
00:01:13,862 --> 00:01:16,371
If I say add, you see,
33

34
00:01:16,371 --> 00:01:19,288
we removed, we destroy, our window.
34

35
00:01:21,483 --> 00:01:24,400
So, this is, we solve this problem.
35

36
00:01:25,477 --> 00:01:27,776
What is next, also I want to show you something.
36

37
00:01:27,776 --> 00:01:29,024
For example here.
37

38
00:01:29,024 --> 00:01:30,406
This is our list bugs, right?
38

39
00:01:30,406 --> 00:01:35,084
We didn't fill, we don't display our persons here, right?
39

40
00:01:35,084 --> 00:01:35,942
It is very simple,
40

41
00:01:35,942 --> 00:01:36,960
we'll do that, okay?
41

42
00:01:36,960 --> 00:01:39,249
We will display our persons here.
42

43
00:01:39,249 --> 00:01:42,989
And also we will update our persons, okay?
43

44
00:01:42,989 --> 00:01:44,301
This is important.
44

45
00:01:44,301 --> 00:01:45,468
And this to...
45

46
00:01:47,539 --> 00:01:48,809
To do that, what we need to do.
46

47
00:01:48,809 --> 00:01:52,559
Here firstly, I will go to find my people and
47

48
00:01:53,427 --> 00:01:56,686
here I need to find my list box, okay?
48

49
00:01:56,686 --> 00:01:59,716
And here my list box is here.
49

50
00:01:59,716 --> 00:02:03,693
And now I will make SQL query, okay, here.
50

51
00:02:03,693 --> 00:02:07,110
And I will say persons is equal to cursor
51

52
00:02:08,121 --> 00:02:11,038
that execute and simply I will say,
52

53
00:02:12,262 --> 00:02:14,929
select, select all from persons.
53

54
00:02:21,402 --> 00:02:23,843
My table name was persons, right?
54

55
00:02:23,843 --> 00:02:25,525
And after here what I need to say,
55

56
00:02:25,525 --> 00:02:28,359
I need to say fetch all, okay?
56

57
00:02:28,359 --> 00:02:31,244
And now I need to show you something.
57

58
00:02:31,244 --> 00:02:33,188
If I say print persons,
58

59
00:02:33,188 --> 00:02:38,034
let's check what Python will return for us, okay?
59

60
00:02:38,034 --> 00:02:41,242
And if I run my application, not this one,
60

61
00:02:41,242 --> 00:02:44,482
I need to run main, right, right?
61

62
00:02:44,482 --> 00:02:45,815
Main, my people.
62

63
00:02:46,695 --> 00:02:49,731
You see now here we have only one record , right?
63

64
00:02:49,731 --> 00:02:52,398
And Python returns for us a list
64

65
00:02:55,038 --> 00:02:57,939
but inside the list another tuple, you see?
65

66
00:02:57,939 --> 00:03:00,034
This is a tuple but this is a list.
66

67
00:03:00,034 --> 00:03:03,792
That means I have one item list, okay?
67

68
00:03:03,792 --> 00:03:06,292
But this list item has a tuple
68

69
00:03:07,339 --> 00:03:11,785
but this tuple will have more than one persons.
69

70
00:03:11,785 --> 00:03:13,434
What I mean, now we have one.
70

71
00:03:13,434 --> 00:03:17,642
If we have two, that means we will have here,
71

72
00:03:17,642 --> 00:03:20,476
this ID name, surname, email and
72

73
00:03:20,476 --> 00:03:22,694
his phone number and his address, right?
73

74
00:03:22,694 --> 00:03:24,927
Let me add a new one, okay?
74

75
00:03:24,927 --> 00:03:26,581
And here run.
75

76
00:03:26,581 --> 00:03:30,079
By the way, now add people button is here.
76

77
00:03:30,079 --> 00:03:34,916
Now already we created our add people Python file, right?
77

78
00:03:34,916 --> 00:03:38,583
So let's also create command for this button
78

79
00:03:40,449 --> 00:03:43,511
because here, where is it, it's second one
79

80
00:03:43,511 --> 00:03:45,526
it's third- it's second one, right?
80

81
00:03:45,526 --> 00:03:50,193
So here I will say command and let's take this guy here,
81

82
00:03:54,737 --> 00:03:57,154
command is equal to self dot,
82

83
00:04:02,028 --> 00:04:03,987
let's say func add people, right?
83

84
00:04:03,987 --> 00:04:05,404
Okay, add people.
84

85
00:04:08,016 --> 00:04:11,848
Okay so what I need to do, I need to come here
85

86
00:04:11,848 --> 00:04:14,098
and say def func add people
86

87
00:04:21,065 --> 00:04:24,721
and here I  need to create a new instance, right?
87

88
00:04:24,721 --> 00:04:26,230
So that what I need to do,
88

89
00:04:26,230 --> 00:04:29,438
I need to import my add people file,
89

90
00:04:29,438 --> 00:04:33,196
import my people and also add people, okay?
90

91
00:04:33,196 --> 00:04:35,779
And here I will say, add people
91

92
00:04:38,464 --> 00:04:41,797
not add people, let's say, add people...
92

93
00:04:48,262 --> 00:04:50,262
Add people window, okay?
93

94
00:04:51,606 --> 00:04:55,908
Add people window is equal to add people dot
94

95
00:04:55,908 --> 00:04:58,659
my class name dot add people, okay?
95

96
00:04:58,659 --> 00:05:01,326
And now we if I run my main run,
96

97
00:05:02,908 --> 00:05:06,034
add people, as you see now also
97

98
00:05:06,034 --> 00:05:09,836
open this window here from main window.
98

99
00:05:09,836 --> 00:05:12,753
Okay, now let's add something here.
99

100
00:05:14,702 --> 00:05:17,535
I will say Adam and let's say here
100

101
00:05:19,880 --> 00:05:21,678
Adam Black, something like that,
101

102
00:05:21,678 --> 00:05:26,511
adam@gmail.com and phone number plus, something like that.
102

103
00:05:28,998 --> 00:05:33,998
For that one I will say, Istanbul and Turkey, okay?
103

104
00:05:38,892 --> 00:05:42,543
Now if I say add person as you see now,
104

105
00:05:42,543 --> 00:05:47,389
it is in our database and now if I click my people,
105

106
00:05:47,389 --> 00:05:48,759
now we don't show it here but
106

107
00:05:48,759 --> 00:05:51,437
let's check our console is here.
107

108
00:05:51,437 --> 00:05:52,896
Let's check it again, you see?
108

109
00:05:52,896 --> 00:05:55,979
Now I have two records here, you see?
109

110
00:05:56,909 --> 00:05:59,215
One and second one is here.
110

111
00:05:59,215 --> 00:06:02,715
But as I said this is one item list, okay?
111

112
00:06:04,094 --> 00:06:08,261
But inside this list we have another tuples, okay?
112

113
00:06:09,185 --> 00:06:14,018
And so how can I get my ID, name, surname and other things
113

114
00:06:16,808 --> 00:06:20,220
(mumbles) because here what I want to show by the one
114

115
00:06:20,220 --> 00:06:23,679
I want to show at my list ID number and
115

116
00:06:23,679 --> 00:06:26,249
also person name and surname, okay?
116

117
00:06:26,249 --> 00:06:30,211
Three values, the first, second and third one is here.
117

118
00:06:30,211 --> 00:06:32,195
So how can I do that?
118

119
00:06:32,195 --> 00:06:35,112
To do that here, I will say, sorry.
119

120
00:06:36,691 --> 00:06:39,524
I need to find my list box, right?
120

121
00:06:40,394 --> 00:06:42,213
List box is here.
121

122
00:06:42,213 --> 00:06:46,213
And here I will say for person in persons, okay?
122

123
00:06:51,022 --> 00:06:53,071
And after it here I need to say
123

124
00:06:53,071 --> 00:06:55,488
self dot list box dot insert.
124

125
00:07:05,457 --> 00:07:08,017
And here what I need to do
125

126
00:07:08,017 --> 00:07:10,587
I need to use a count here, okay?
126

127
00:07:10,587 --> 00:07:11,420
Why is like that?
127

128
00:07:11,420 --> 00:07:14,240
Because I need to pass in index number.
128

129
00:07:14,240 --> 00:07:17,970
And I'm using for loop here and each time, for example
129

130
00:07:17,970 --> 00:07:22,154
for second line I need to use index starts from zero.
130

131
00:07:22,154 --> 00:07:23,877
Zero, one, two, three, four, five
131

132
00:07:23,877 --> 00:07:25,014
something like that, okay?
132

133
00:07:25,014 --> 00:07:26,908
So how many people I have, I don't know, okay?
133

134
00:07:26,908 --> 00:07:28,566
It will come from my database.
134

135
00:07:28,566 --> 00:07:31,513
And to do that I need to say here,
135

136
00:07:31,513 --> 00:07:34,760
I need to create a variable count is equal to zero, okay?
136

137
00:07:34,760 --> 00:07:38,927
For index, now control P as you see it says index.
137

138
00:07:39,770 --> 00:07:42,381
For index I will take count, okay?
138

139
00:07:42,381 --> 00:07:44,076
For the first one count in this
139

140
00:07:44,076 --> 00:07:47,662
should be zero for second one, will be one, two and so on.
140

141
00:07:47,662 --> 00:07:52,579
And after here I will say str person first item, okay?
141

142
00:07:56,780 --> 00:08:01,139
If you want to get that one, you need to say person zero.
142

143
00:08:01,139 --> 00:08:04,806
For name person one, for surname person two,
143

144
00:08:05,945 --> 00:08:10,027
for e-mail person three and so on, okay?
144

145
00:08:10,027 --> 00:08:12,482
And after that here what I need to do
145

146
00:08:12,482 --> 00:08:15,565
I want to create here a string, okay?
146

147
00:08:17,447 --> 00:08:20,780
For the string I will say quotes and dash
147

148
00:08:22,263 --> 00:08:25,763
after string again, plus symbol and person
148

149
00:08:26,708 --> 00:08:29,103
this time I will use one.
149

150
00:08:29,103 --> 00:08:31,853
Okay, this is for name and again,
150

151
00:08:32,718 --> 00:08:37,150
I want to use another string here and gap, okay?
151

152
00:08:37,150 --> 00:08:40,983
And here I will say again plus symbol, person.
152

153
00:08:42,444 --> 00:08:45,027
This time it will be two, okay?
153

154
00:08:46,122 --> 00:08:49,289
And after that  what I need to do, I need to say here
154

155
00:08:49,289 --> 00:08:51,872
count plus equals 1, okay?
155

156
00:08:56,285 --> 00:08:58,044
And we are done now.
156

157
00:08:58,044 --> 00:09:02,384
If I run my application, we have already the two records, right?
157

158
00:09:02,384 --> 00:09:05,374
Here if I say my people, you see, boom.
158

159
00:09:05,374 --> 00:09:07,124
David Blue, Adam Black.
159

160
00:09:07,124 --> 00:09:09,041
And our people is here.
160

161
00:09:10,146 --> 00:09:13,479
And actually for this lesson it's enough
161

162
00:09:14,718 --> 00:09:17,399
we're not update, we will create update page
162

163
00:09:17,399 --> 00:09:19,785
in next one, in next lesson, okay?
163

164
00:09:19,785 --> 00:09:23,445
And our lesson is already almost 10 minutes.
164

165
00:09:23,445 --> 00:09:27,695
And  see you in the next!
