Python for Absolute Beginners Transcripts
Chapter: Using external Python packages
Lecture: Adding a little more UI to rock paper scissors
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Our game is okay, but boy could it use some color
0:03
or some UI or something, right?
0:06
It all just blends together.
0:07
It would be much, much nicer if we could quickly indicate
0:11
who's playing what, whether or not you've won, and so on.
0:14
So what we can do, is we can use an external library
0:17
that will make it very easy for us to output color
0:20
instead of regular lain text.
0:22
You can do it without these libraries,
0:23
but it's complicated,
0:24
it's different across different operating systems.
0:27
With these cool external libraries, you just basically say
0:29
print, but make it blue, or print, but make it yellow,
0:32
and then out it comes.
0:33
So this is actually going to be a big improvement to our app,
0:36
and we're going to get a library called Colorama
0:38
that let's us do this.
0:40
But, we could go a little farther.
0:41
We could come in here and we could say,
0:43
in addition to color, it's one thing to have that great
0:46
long list of one, two, three, four, five,
0:48
but what about a little dropdown in our terminal here?
0:51
That'd be really cool, right?
0:53
And it can autocomplete, so if we typed S,
0:56
it'll pull up scissors and sponge in our final example.
0:59
Even if we typed, I don't know, R,
1:01
it would pull up rock, and scissors,
1:02
and I guess paper, as well.
1:04
But, you know, if you type enough that it's going to narrow
1:06
it down, then it'll pull those up.
1:07
Like if you hit C, it would be rock and scissors.
1:10
So, we're going to be able to add that little UI
1:11
using a different library and combine these two,
1:15
and you'll see that it's easy to do.
1:17
We basically say their name, we ask Python
1:19
to go get them for us, and then we can just start working
1:21
with these extra libraries.
1:23
It's going to be really fun.