Hello again, what we have so far is two buttons, so this is the first screen with a camera being
played and then we Capture a button, but the Capture button is actually creating an image file,
but it's not switching the screen.
So now we need to switch the screen to the other screen where we show this picture, the frame that
the image, that the button captured and also these other buttons which we have
in our design-frontend, so we implemented the screen successfully.
Now we need to create this image screen.
So the current frame will be displayed here as an image and then we're going to have this button, this label here,
which is going to be populated with text when this button is pressed and then we're going to have
these two other buttons in here.
OK, so our main.py file is this one, and this is an image screen image, the ImageScreen class.
We need to create an ImageScreen rule in here.
So you can refer to these as sister objects or rules also, and of course, we need a GridLayout.
How many columns? Just one, again.
So just one column.
Actually, here we are going to have two columns and how can we do that?
Well, not very difficult to do.
This is how we can do it.
Let's start from top to bottom.
The grid layout is going to have an Image widget.
So Image is a widget.
Let's leave it without attributes for now.
And then we're going to have a Button widget.
With text:
'Create shareable link' and then
a label with text...
Well, what's the text?
The text has to be the actual link that is going to be generated.
But for now, we can just set an empty string for the link.
Then what else do we have?
So create link label, and then here we can have another GridLayout, but carefully, this is part
of this other GridLayout or it's a child of that.
So it's a GridLayout inside another GridLayout, which is going to have two columns.
These are the two buttons, so the first button is going to have as text:
'Copy link' and the other button is going to have as text:
'Open link'.
So when we set these 2 here for the number of columns, Python or Kivy will automatically render these
buttons horizontally.
So it's going to fill the columns, first the first column with this button and then the second column.
You see how it's going to look like.
And lastly, we need to add
ImageScreen, or to register ImageScreen with the ScreenManager, id: image_screen, name in quotes,
'image screen', and let's
execute the program, start the camera.
Press the Capture bottun.
Nothing is happening.
Why?
Because... I know why. In the capture() method, we are not instructing anything about changing the screen,
we are simply generating a png file.
So what we need to do is to say self.manager.
So we are accessing the manager attribute from the Screen instance or from the CameraScreen instance.
Manager is part of the parent of CameraScreen, so of the Screen. Manager.current.
So we want to set the current screen to 'image_screen'.
That's actually the name
of the ImageScreen, this one here, that's how we are able to access that ImageScreen screen.
So just like that, if I execute again now.
Start camera, Capture, and here is the next screen, so that's the screen we just built.
That is the image frame that you see here.
And that is the image widget, that is the 'Create Sherable Link' button.
So here we have them, image, button.
Then we have this label here, which is empty for now.
And then we have this GridLayout, which has two buttons stacked horizontally, 'Copy Link' and 'Open
Link'.
And that's how you build a second screen, that's how you switch to the second screen by having a
method which should be in the first screen.
So in our case, the capture method was the method that did the switch to the next screen.
And thanks for following.
I hope you like this video and I'll talk to you later.