Widgets are fundamental components of user interfaces, and in Streamlit they allow you to create interactivity directly in your applications. With just a few lines of code, you can add buttons, checkboxes, selectors, and more.
Streamlit with Python: How to Do Data Entry in Streamlit
Article:
💖 Donate and help us create more amazing content!
🙌 Every contribution makes a difference!
☕ Buy me a coffee: https://buymeacoffee.com/usandopython
💖Support this channel
https://www.youtube.com/channel/UCpL2Gru508Z39oPqu1FIg4Q/join
⚡️ Connect with me on:
Instagram: https://www.instagram.com/pybeginners/
Twitter: https://x.com/joaofuti_
LinkedIn Newsletter: https://www.linkedin.com/newsletters/pybeginners-7267881715929415681/
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
joh here so today we are going to learn
0:03
how we can work with the number input
0:06
and test input okay so apart of this
0:09
okay we are going to work we can work
0:10
with data input also uh even time input
0:14
so we are going to work with a lot of
0:15
input options in stream L okay so uh
0:19
last video we work in this ones okay in
0:22
those bottoms okay which are some kind
0:24
of input also but today will be the most
0:28
awaited one I can say as how we can get
0:31
the N for us how we can get the data
0:36
that user will enter in our app okay so
0:40
this is what you're going to learn so in
0:42
order to work with any
0:44
input data in stream L okay so we have
0:47
those options so let me just delete
0:49
those this ones okay I'm going to delete
0:52
this one okay so the first one that we
0:54
are going to work with is how we can get
0:56
the number okay input okay for example
0:59
if a user want to enter any number in
1:02
our stream L app okay we can do
1:04
something like this okay for them let me
1:06
create the let me create a variable
1:09
called number okay boom number so this
1:11
number will be equal St
1:16
doore input oh input number score input
1:20
open and close something like this okay
1:23
see then here we can say something okay
1:28
choose uh and let's say let's give some
1:31
option okay choose a choose a number
1:35
choose a number save and Dot give a
1:38
little space and let's come here let's
1:40
give comma and let's give like a mean so
1:44
in number input okay we can give like
1:46
the mean and max value that can be
1:49
inserted inside of this option okay so
1:52
let's do mean value will be for equal
1:56
one okay comma then let's give us to Max
2:00
underscore
2:01
value uh will be equal 100 so let me
2:06
give comma then say value equal 10 okay
2:10
save if I come here in our app if I
2:14
refresh this thing as you can see I have
2:17
here 10 okay so it will start with 10 so
2:19
what is this so this is where is okay so
2:21
I give like a limit for Min value so it
2:24
can be only one and the max value can be
2:27
100 okay so that means you can enter all
2:30
in the values okay in between these TW
2:33
okay so then I give it value 10 so value
2:35
10 is the value to start with okay so
2:37
here as you can see okay when we start
2:40
our app it show in the at the first
2:43
instance number 10 okay so here we can
2:46
for examp increase we can also decrease
2:49
but if for example if I put it one okay
2:52
if I try to decrease as you can see it's
2:54
not possible okay even if I put it 100
2:56
if I try to increase it's not possible
2:58
even if I for if I give 200 and I click
3:01
like this it said value must be less
3:03
than or equal to 100 as you can see okay
3:07
that's why we put that mean and max
3:09
value so let's give 70 so how we can get
3:12
the values from here so in order to get
3:14
the values from here we need to do
3:16
something like this I just need to come
3:17
here okay let me give down then we need
3:20
to write something this s dot do What
3:23
DOT right as always okay dot right open
3:28
and close and what is going to write
3:29
going to write let me use F string and
3:31
do something like this okay choosen okay
3:34
choos a
3:36
number let me see choose a number Dot
3:40
and since I use F string I can do like
3:42
this and just put it okay
3:44
number something like this and save now
3:47
if I come here back if I boom okay as I
3:52
say chooseing number you put 10 okay if
3:54
I move on 11 if I keep moving is going
3:57
to change okay if I put two
4:00
200 is not showing as you say Okay value
4:04
must be less than or equal 100 okay but
4:07
if I put here for 75 boom it show 75
4:11
okay so this is how you can work with
4:13
numbers okay for if you want for examp
4:15
if you want for the input to accept only
4:17
numbers you can work in this way okay
4:19
you can use the number input so apart of
4:21
number input we can work also with the
4:24
text input so in order to work uh for
4:27
the testt input is something like this
4:29
let's create a variable called email so
4:31
this email will be equal St do do what
4:37
textor input test input open and close
4:42
so here we can say something like this
4:43
okay
4:45
enter a enter what enter your email
4:49
enter your email okay enter your email
4:53
dot give a little space and save okay
4:56
then I can come here okay oh let me
4:58
change this name is very very bad okay
5:01
email this way perfect now if I come
5:03
here and if I
5:05
refresh as you can see enter your email
5:08
okay this is the field for the email
5:10
option close this guy now if I come here
5:13
okay in order to get that email I can
5:15
say also SD dot as always it's right
5:18
that's why I say you will use right a
5:20
lot of time okay right what this thing
5:23
and
5:25
email okay do this and open and close
5:29
sorry open and close what we need to do
5:32
just need to give this email one okay
5:34
save if I come here and refresh boom as
5:39
you can see here now if I enter any
5:40
email for at
5:44
gmail.com boom as you can see it's
5:46
showing me the email here okay so this
5:49
is how you can work with the test input
5:51
okay in order to get the test input you
5:53
can use St do text input so apart of
5:57
text input okay we can work also for
6:00
selecting a date okay so for selecting a
6:03
date we can do something like this let
6:05
me see I'm going to create a varable
6:07
called date this date will be equal St
6:10
dot date date what date inputs okay so
6:14
date input uh help us to selecting a DAT
6:18
okay so if I'm I'm going to open here
6:21
and save now if I come here if I refresh
6:24
this guy as you can see it give error
6:27
okay so when you create the date input
6:29
you need to give a label here okay like
6:30
you need to give a name you need to say
6:32
something let's say
6:34
select oh oh I forgot e select select
6:38
what select a date save okay select a
6:42
date let's put dots give a little space
6:44
I like that and come here now okay let's
6:46
say now St oh before I write that let me
6:49
save this if I come here if I refresh as
6:53
you can see now it's showing here okay I
6:55
click this I can select any date okay
6:57
for it will give a in the beginning it
7:00
will give the actual date okay which
7:02
today is 3rd of April 25 okay can select
7:07
any date I can go up I can go back
7:11
something like this okay you can select
7:13
whatever you wish it will show here okay
7:15
so in order to get this the selected
7:18
date we can do something like this okay
7:20
s do write right what open and close
7:25
let's use F string and do something like
7:27
this what we can do we can do something
7:30
selected
7:31
selected date close let's say okay let's
7:35
open and close what we can do we can do
7:37
some dat okay and save now if I come
7:42
here if I refresh this guy as you can
7:45
see select the date is showing this
7:47
select the date that is here okay if I
7:49
come here if I choose 19 boom it's
7:51
showing 19 this is how you can pick up
7:53
the date that you will selected in the
7:55
calendar okay in stream L perfect
7:59
okay apart of that we can also use the
8:04
time okay we can select also time okay
8:07
so in order to use the selected time we
8:08
can do something like this let me create
8:10
a variable called time open and close we
8:12
can see St do time okay time what time
8:17
input this way open and close and commit
8:20
and let's say something like this okay
8:24
choose a choose a what choose a Time
8:28
choose a Time
8:30
Perfecto choose a time so in order to
8:33
choose a time I can s do write open and
8:38
close right what I can do something like
8:40
this and boom let's say now
8:44
selected time dot if I open this look
8:49
this I can do something this oh sorry I
8:53
can do some of this okay time save in
8:56
order to see this okay the select the
8:58
time I can just come in here refresh
9:00
this guy okay select the time see it's
9:03
showing this time now is this is the
9:05
time right now okay and if I come here I
9:08
see there is a lot of time so it's it's
9:09
giving like gap of 15 minutes 15 minutes
9:12
I can choose any time okay so I can just
9:15
come here and I choose this 19 it's
9:17
going to give me this time okay so when
9:19
you choose time then you can do whatever
9:22
you wish okay in according to the time
9:24
so this is how you can work with the
9:26
data okay that the user will uh enter in
9:30
stream L okay so apart of this there is
9:33
another one which is really really
9:35
really important important okay which is
9:38
the text area so in order to work with
9:41
the text area we need to do something
9:44
like this I'm just come here okay I will
9:46
come here so let's create a variable
9:48
called description okay description
9:51
description description so this
9:53
description will be uh will be
9:56
equal so description will be equal let's
9:58
do something St do text underscore area
10:04
open and close and I'm going to do
10:06
something like this okay description
10:09
description description okay dot save
10:14
okay now if I come here okay if I save
10:17
this guy and if I can come here if I
10:21
refresh we can see the description area
10:23
here okay we can enter whatever you want
10:25
okay we can open this as you wish
10:30
okay and we can keep enter things here
10:33
okay so this how we can get a test area
10:37
okay so in order to get the text area is
10:39
the same thing okay St dot
10:43
write what I'm going to write I'm going
10:45
to write the this guy okay and let me do
10:49
this I'm going to use F string and come
10:52
here inside let's say
10:54
provided provided
10:57
description provided description
11:00
okay provide description dot what I'm
11:01
going to do let me get the description
11:03
okay
11:05
description save now if I come here okay
11:10
boom right provide the description okay
11:12
let me give okay
11:14
hello my name
11:17
is
11:18
and I am I am what I am
11:22
from Angola I am from Angola okay if I
11:26
click in area as you can see hello my
11:28
name is and I am from Angola this is how
11:31
you can work with taste okay in stream
11:37
lit okay so guys you uh we will stay
11:41
here okay so in the
11:43
next episode okay we will learn more
11:46
about the stream l so but for now let's
11:48
stay here okay so please like the video
11:51
subscribe to the channel and support us
11:54
to the channel okay so it's very
11:55
important for us so that we can grow and
11:57
we can try to come up with cool
11:59
tutorials okay so thank you for watching
12:02
and see you in the next video bye-bye
#Programming
#Software
#Scripting Languages

