Tkinter is Python's most popular Graphical User Interface (GUI) library. This topic explains the proper use of this library and its resources.
Python Tkinter: How to create an Entry in Tkinter
Support the Channel šš:
Buy me a coffee ā : https://buymeacoffee.com/usandopy_
ā”ļø Connect with me on:
Instagram: https://www.instagram.com/pybeginners/
Twitter: https://x.com/joaofuti_
LinkedIn: https://www.linkedin.com/in/joao-futi-muanda-16b980175/
Website: https://www.usandopy.com/en
Thread: https://www.threads.net/@pybeginners
Show More Show Less View Video Transcript
0:00
hello guys welcome back to the channel
0:01
my name is j so today in this tutorial
0:03
we are going to learn how we can create
0:05
an entry in the K in Python so entry is
0:09
this box that you can see okay a box
0:12
that we can enter any test any number
0:14
any information from the wi okay from
0:17
the application so we are going to learn
0:19
how we can create this so this is the
0:21
syntax to create a entry iner okay so it
0:25
use the class entry then here we give
0:27
the options okay that we need that we
0:30
require so in this video we're going to
0:32
operate uh operation like okay how to
0:34
create the entry how to show the entry
0:37
in the window okay we can show this way
0:39
okay and how to set the properties of
0:42
entries sorry it's supposed to be entry
0:45
not bottom my mistake and how to get
0:48
okay the any entry using the entry class
0:51
okay so how to how we can get
0:53
information that we going to put here
0:55
okay so that we can manipulate this
0:56
information we are going to learn that
0:58
and how to disable and entry in also we
1:02
are going to learn all those stuff in
1:04
this same video okay so as always let's
1:07
go to our test editor which is this guy
1:10
okay so this was the previous video that
1:12
we had
1:13
okay H which talk about bom so but now
1:16
we are going to talk about hentry in
1:19
okay so so for that is like okay we are
1:21
going to reuse these guys itself okay
1:24
let's keep here we don't need to delete
1:26
them but uh first let's create our entry
1:30
so that we can uh how can I say so that
1:33
we can use all of them together okay so
1:36
how we can do if I run this guy okay let
1:40
me run boom okay here we I can see that
1:42
we have a bottom and we have a label
1:45
okay so the only thing that we're going
1:47
to do is let's decrease the font of this
1:51
that is too big okay uh let's
1:54
say at least uh we don't need this guys
1:57
you guys can go out save if I run okay
2:00
make it normal bom done and
2:05
uh okay this can keep okay so let's H
2:09
down okay after the label boom uh this
2:13
label okay let's say for example
2:16
okay and say something say oh no write
2:21
something
2:23
write something write something okay so
2:26
let's we are telling the user to write
2:28
something okay dot give
2:30
they us it to write something okay
2:34
so let's create another
2:36
label okay so this label will show the
2:39
information that user will write okay
2:42
and so this label we can say something
2:46
like underscore
2:49
info info I can just cop this guy and
2:52
come here boom okay so this
2:56
info it can be
3:00
down okay yeah it can be down yeah it
3:03
can be if Row one row two do you come
3:05
down okay you come down if I save this
3:08
in the I room okay you come okay this
3:12
info will be showing here okay uh let's
3:15
say here this is
3:19
info uh this is info okay this is
3:24
info so now let's create entry okay so
3:27
in order to create entry let's create
3:29
one uh variable first okay uh I can call
3:32
it for example info okay info so this
3:36
info will be equal so to create entry in
3:39
we use the class entry okay like this
3:42
entry open and close so here inside we
3:44
have to give the information so for
3:46
examp let's put it on window window so
3:50
entry it has few uh few attributes that
3:54
we can change okay so after that we can
3:56
Define the width of in okay for the wi
4:00
equal for example 10 okay
4:03
save after that we can call this guy
4:06
this info dot let's use grid also and
4:11
you come back let's use this guy you
4:15
come
4:16
here come I press so since that guy is
4:19
there so come in row zero stay on the
4:23
column one save if I run this guy so
4:27
it's supposed to be here so just let me
4:29
move move this let move this guy on
4:31
column two okay say if I run this boom
4:35
now we have our entry where we can enter
4:38
anything as you can see and we have our
4:41
botom here
4:43
okay so uh let's remove those stuffs
4:46
here let's say pass boom so this is how
4:51
we can create a entry
4:53
in
4:57
okay but uh I didn't like entry because
5:00
it's too small so let's give let's
5:02
increase its width okay at least uh 20
5:06
save and if I run boom okay it's a
5:08
little big now if I click it nothing is
5:10
happen nothing is happen so the next
5:12
thing which is really really important
5:14
is how to get the information from entry
5:16
okay so in order to get any info from
5:19
entry you have to use something like
5:21
that okay this is the end that that was
5:23
the ENT okay so for if I come inside of
5:25
this class to get the info from the
5:28
entry I can see something like that okay
5:29
information information information okay
5:34
this information will be equal equal the
5:36
name of the entry what's the name of our
5:38
entry the name of our entry is info I'll
5:41
get that info I'll put here so I can put
5:43
dot get okay we use the function get to
5:47
get the information which is enter
5:49
inside the entry bottom okay so I do
5:52
like this save Okay then if I come here
5:57
I can just print that information that
5:59
I'm going to get okay print print what
6:02
information okay I'm going to print that
6:04
information save if I run this okay let
6:07
me run this boom okay for if I click
6:10
here nothing is happening okay but it's
6:12
supposed to print nothing happened
6:14
because I didn't give any information
6:16
inside of my entry but for if I give
6:18
something like that okay he said write
6:20
something okay hello I
6:24
am okay if I click it boom it got the
6:28
information inside of and then he print
6:30
hello okay he print that information
6:32
here okay let me see if I click again it
6:34
just keep clicking hello because I'm
6:36
clicking okay if I say only boom like
6:39
hello I am now it's printing hello I am
6:42
okay this way is getting the information
6:44
and it's
6:46
printing but we want this information to
6:48
be show here okay not printing here okay
6:52
so in order for that we can do what we
6:54
did in the last uh video okay which is
6:57
the same thing okay we can do just
6:58
something like that okay we can call the
7:00
name of this label in okay let's call
7:03
our label
7:05
in so label in okay dot configure
7:10
configure this way okay and open and
7:13
close what you want to change in the
7:15
info we want to change this guy okay we
7:18
can say test equal okay uh test can be
7:24
equal so equal what equal information
7:32
we can put equal information save and if
7:34
I save this if I run this okay let me
7:37
see so this is info okay so if I write
7:39
something
7:41
hello I
7:43
am okay if I click this boom hello I am
7:46
so this way it's changing Dynamic okay
7:48
if I remove if I just click like this
7:50
boom I am hello I am something like that
7:53
so whatever we right here and we click
7:56
here so our function will get the info
7:58
then it will put it here inside of this
8:01
INF okay so now we don't need this
8:02
anymore so we can just for example let
8:05
me see remove this guy keep it empty
8:07
save if I
8:09
run if I put some information here I
8:12
click boom no it's giving the
8:15
information okay let me see I
8:19
am from Angola okay if I click here boom
8:24
I am Johan from Angola so this is how we
8:27
can create entry in Python teer and how
8:30
you can get the information inside the
8:32
entry in Python
8:34
T so the last operation that we need to
8:37
perform is how we can disable our entry
8:39
okay so that nothing can be given so to
8:43
disable our entry we can do something
8:44
like that okay for I can come here okay
8:47
so uh for example we want after I get my
8:52
information I want the entry to be
8:54
disabled okay so so that for that I can
8:56
do something like that okay I just can
8:57
come call my entry here okay in info
9:00
info I can do like this okay
9:04
um info do configure this way open okay
9:10
I can just say State sorry yeah State
9:13
this way okay State equal I do like this
9:16
then I just give disable disable this
9:19
way okay if I save and if I run this
9:22
code okay let's see uh where is it oh oh
9:27
is here if I say hi
9:32
I I
9:35
am from Angola I am joh from Angola if I
9:39
click this boom okay you print this I am
9:42
joh from Angola now our label is
9:43
disabled I'm not able anymore to put
9:45
anything there even if I click here okay
9:47
nothing's going to happen because after
9:50
you get the information it will set the
9:52
information here then it will disable
9:55
the information okay and I can do also
9:56
directly from here okay I just can just
9:58
for them if I copy this guy here copy
10:00
where is my entry I can come here after
10:03
with comma I place it save in the f r
10:06
boom as we can say my entry is disabled
10:09
I'm not able to put any information
10:11
there even if I click nothing's going to
10:13
happen because not getting any info
10:15
there okay so guys this is how you can
10:16
create an entry and how you can get the
10:19
information inside of entry in Python
10:21
tick enter okay so my name is if you
10:24
like the video give a like to the video
10:26
subscribe to the channel and for more
10:28
things that is going on come okay like
10:30
for example a lot of projects that will
10:32
come after this basics of python te okay
10:36
see you in the next video bye
#Programming
#Scripting Languages

